GitHub SSH Workflow

GitHub SSH Workflow

  1. Visit repository on GitHub
  1. Make sure secrets are set for: HOST, USERNAME, KEY and PORT , in the repositories settings (Settings → Secrets)
  1. Click Actions → Set up a workflow yourself
  1. Copy this code into there.
    1. name: remote ssh command
      on: [push]
      jobs:
        build:
          name: Build
          runs-on: ubuntu-latest
          steps:
          - name: executing remote ssh commands using password
            uses: appleboy/ssh-action@master
            with:
              host: ${{ secrets.HOST }}
              username: ${{ secrets.USERNAME }}
              key: ${{ secrets.KEY }}
              port: ${{ secrets.PORT }}
              script: |
                      cd [Website Public Folder]
                      git pull
  1. The action will automatically run when it’s been committed.
 

SSH Keys

GitHub no longer supports RSA SSH keys so the keys on the server need updating to use the ECDSA standard. Read more here.
Use new type of key as general SSH Key, use old type (ssh-keygen) for automations

Generate ECDSA SSH key

ssh-keygen -t ecdsa -b 256