Skip to content

Commit

Permalink
Configure SSH without 3rd-party action
Browse files Browse the repository at this point in the history
  • Loading branch information
psiemens committed Dec 3, 2024
1 parent caa5350 commit 9d1be37
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,22 @@ jobs:
# ssh_private_key: '${{ secrets.GCP_SSH_PRIVATE_KEY_STAGING }}'
# command: 'echo Hello world'

- uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.GCP_SSH_HOST_STAGING }}
username: deploy
key: ${{ secrets.GCP_SSH_PRIVATE_KEY_STAGING }}
port: 22
script: whoami
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
env:
SSH_USER: deploy
SSH_KEY: ${{ secrets.GCP_SSH_PRIVATE_KEY_STAGING }}
SSH_HOST: ${{ secrets.GCP_SSH_HOST_STAGING }}

- name: Test
run: ssh staging 'whoami'

0 comments on commit 9d1be37

Please sign in to comment.