This GitHub Action deploys content to a remote server using rsync. It's a fork of Pendect/action-rsyncer which adds support for custom SSH ports.
Add an SSH public key to the server.
Add the corresponding private key to the repository as an encrypted secret named DEPLOY_KEY
.
In .github/workflows/<your-workflow-name>.yml
, add the following steps (note: src
is relative to $GITHUB_WORKSPACE):
- name: Deploy to server
id: deploy
uses: platform-coop-toolkit/rsync-deploy@master
env:
DEPLOY_KEY: ${{secrets.DEPLOY_KEY}}
with:
flags: '-azrh --delete' # rsync flags (default: '-azrh')
port: '22' # SSH port (default: 22)
src: 'build/' # Local path to deploy, relative to $GITHUB_WORKSPACE (default: '')
dest: '[email protected]:/var/www/example.com'
- name: Display deployment status
run: echo "${{ steps.deploy.outputs.status }}"