Combine SSH setup and deployment
All checks were successful
Deploy to Server / deploy (push) Successful in 30s
All checks were successful
Deploy to Server / deploy (push) Successful in 30s
- Consolidates SSH setup and deployment into a single step. - Simplifies the deployment workflow by combining steps. - Uses a more concise SSH command for deployment. - Removes unnecessary SSH key agent initialization. - Uses relative path `repo` in the deployment command.
This commit is contained in:
parent
6a4aef9042
commit
7885f6790e
@ -13,7 +13,7 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup SSH
|
- name: Setup SSH agent and deploy
|
||||||
run: |
|
run: |
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@ -21,15 +21,10 @@ jobs:
|
|||||||
chmod 700 ~/.ssh
|
chmod 700 ~/.ssh
|
||||||
ssh-keyscan "$SSH_HOST" >> ~/.ssh/known_hosts
|
ssh-keyscan "$SSH_HOST" >> ~/.ssh/known_hosts
|
||||||
chmod 644 ~/.ssh/known_hosts
|
chmod 644 ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
ssh -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" "cd repo && git stash && git pull --force origin master && ./build.sh"
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy via SSH
|
|
||||||
run: |
|
|
||||||
ssh -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" 'cd /home/rogsme/repo && git stash && git pull --force origin master && ./build.sh'
|
|
||||||
env:
|
|
||||||
SSH_USER: ${{ secrets.SSH_USER }}
|
SSH_USER: ${{ secrets.SSH_USER }}
|
||||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||||
SSH_PORT: ${{ secrets.SSH_PORT }}
|
SSH_PORT: ${{ secrets.SSH_PORT }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user