File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,25 @@ jobs:
1313 - name : Checkout Repository
1414 uses : actions/checkout@v3
1515
16- - name : Set up SSH
17- uses :
webfactory/[email protected] 18- with :
19- ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
16+ - name : Set up SSH with passphrase
17+ env :
18+ SSH_PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
19+ VM_PASSPHRASE : ${{ secrets.VM_PASSPHRASE }}
20+ run : |
21+ mkdir -p ~/.ssh
22+ echo "$SSH_PRIVATE_KEY" > ~/.ssh/deployment_key
23+ chmod 600 ~/.ssh/deployment_key
24+ eval "$(ssh-agent -s)"
25+ # Use expect to send the passphrase
26+ expect -c "
27+ spawn ssh-add ~/.ssh/deployment_key
28+ expect \"Enter passphrase for ~/.ssh/deployment_key:\"
29+ send \"$VM_PASSPHRASE\r\"
30+ interact
31+ "
2032
2133 - name : Add Azure VM to known_hosts
2234 run : |
23- mkdir -p ~/.ssh
2435 ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts
2536
2637 - name : Synchronize Code with VM Using rsync
You can’t perform that action at this time.
0 commit comments