Skip to content

Commit 8478e07

Browse files
authored
Update main.yml
1 parent 2cfa380 commit 8478e07

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)