File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1313 - name : Checkout Repository
1414 uses : actions/checkout@v3
1515
16- - name : Set up SSH with Password Authentication
17- run : |
18- echo "$PASSWORD" | sudo -S echo "Password authentication is set up" # Use PASSWORD secret for sudo
19- env :
20- PASSWORD : ${{ secrets.PASSWORD }}
16+ - name : Install sshpass
17+ run : sudo apt-get install -y sshpass
2118
2219 - name : Add Azure VM to known_hosts
2320 run : |
@@ -28,18 +25,18 @@ jobs:
2825 run : |
2926 cat ~/.ssh/known_hosts # Optional step to confirm the host is added
3027
31- - name : Synchronize Code with Azure VM Using rsync
28+ - name : Synchronize Code with Azure VM Using rsync and sshpass
3229 env :
33- RSYNC_RSH : " ssh "
30+ PASSWORD : ${{ secrets.PASSWORD }}
3431 run : |
35- rsync -avz --exclude='.git' --exclude='.env' -e "ssh -o PreferredAuthentications=password -o PubkeyAuthentication =no" ./ ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/home/devops/CAPEC-Rag/
32+ sshpass -p "$PASSWORD" rsync -avz --exclude='.git' --exclude='.env' -e "ssh -o StrictHostKeyChecking =no" ./ ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/home/devops/CAPEC-Rag/
3633
3734 - name : Restart Docker Compose Services
38353936 with :
4037 host : ${{ secrets.VM_HOST }}
4138 username : ${{ secrets.VM_USER }}
42- password : ${{ secrets.PASSWORD }} # Using the PASSWORD secret for SSH login
39+ password : ${{ secrets.PASSWORD }}
4340 script : |
4441 echo "Stopping existing Docker Compose services..."
4542 cd /home/devops/CAPEC-Rag/
You can’t perform that action at this time.
0 commit comments