Skip to content

Commit

Permalink
Merge pull request #84 from dothq/staging
Browse files Browse the repository at this point in the history
πŸ› Init ssh directory before installing keys
  • Loading branch information
kierandrewett authored Apr 27, 2024
2 parents 3cf0d83 + 86563d2 commit 14af5b6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/actions/run-via-ssh/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ runs:
tags: ${{ inputs.ts_tags }}

- name: Install SSH key
shell: bash --noprofile --norc -eo pipefail -ux {0}
shell: bash --noprofile --norc -eo pipefail {0}
run: |
mkdir -p ~/.ssh
install -m 600 -D /dev/null ~/.ssh/id_rsa
install -m 600 -D /dev/null ~/.ssh/known_hosts
echo "${{ inputs.ssh_private_key }}" > ~/.ssh/id_rsa
SERVER_IP="$(tailscale ip -6 ${{ inputs.ts_hostname }})"
ping -c 3 $SERVER_IP
ssh-keyscan $SERVER_IP > ~/.ssh/known_hosts
- name: Run script
shell: bash --noprofile --norc -eo pipefail -ux {0}
shell: bash --noprofile --norc -eo pipefail {0}
run: |
SERVER_IP="$(tailscale ip -6 ${{ inputs.ts_hostname }})"
ssh -t ${{ inputs.ssh_username }}@$SERVER_IP "${{ inputs.run }}"
- name: Nuke SSH keys
shell: bash --noprofile --norc -eo pipefail -ux {0}
shell: bash --noprofile --norc -eo pipefail {0}
run: rm -rf ~/.ssh

0 comments on commit 14af5b6

Please sign in to comment.