Skip to content

Commit

Permalink
Fixed deployment actions script (#3)
Browse files Browse the repository at this point in the history
piped the password to sudo command with `-S` flag and fixed the restart error in the script
  • Loading branch information
vishalkrishnads authored Jul 28, 2024
1 parent 7eabcb2 commit 9d52f28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:

jobs:
build:

runs-on: ubuntu-22.04

steps:
Expand All @@ -25,11 +24,12 @@ jobs:
run: sudo apt-get install sshpass rsync
- name: write changes to server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' target/release/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/server/; sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' scripts/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/scripts/
sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' target/release/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/server/
sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' scripts/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/scripts/
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}
- name: restart server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} ssh -o StrictHostKeyChecking=no vishalds@${{ secrets.VPS_HOST }} 'sudo systemctl restart zitefy.service'
sshpass -p ${{ secrets.VPS_PASSWORD }} ssh -o StrictHostKeyChecking=no vishalds@${{ secrets.VPS_HOST }} 'echo ${{ secrets.VPS_PASSWORD }} | sudo -S systemctl restart zitefy.service'
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}

0 comments on commit 9d52f28

Please sign in to comment.