Created
July 1, 2022 09:55
-
-
Save antoniopicone/2d3c6f167c682760a1889507a25e94d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
jobs: | |
ssh: | |
name: "ssh to remote server" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create SSH Config on temporary VM | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/ssh_key | |
chmod 600 ~/.ssh/ssh_key | |
cat >>~/.ssh/config <<END | |
Host remote_server | |
HostName $SSH_IP | |
User $SSH_USER | |
IdentityFile ~/.ssh/ssh_key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_IP: ${{ secrets.SSH_IP }} | |
- name: SSH into the server | |
run: | | |
ssh remote_server 'ls -l' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment