- Visit repository on GitHub
- Make sure secrets are set for:
HOST
,USERNAME
,KEY
andPORT
, in the repositories settings (Settings → Secrets)
- Click Actions → Set up a workflow yourself
- Copy this code into there.
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
- 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