Skip to content

Instantly share code, notes, and snippets.

@raazon
Created April 15, 2022 13:33
Show Gist options
  • Save raazon/22fcc9071c83cabf9001edc0b9adbe2d to your computer and use it in GitHub Desktop.
Save raazon/22fcc9071c83cabf9001edc0b9adbe2d to your computer and use it in GitHub Desktop.
GitHub Action for deploying code via rsync over ssh https://github.com/Burnett01/rsync-deployments
name: 🚀 Production rsync deployment by SSH/SFTP
on:
push:
branches: [ main ]
jobs:
build:
name: Build
if: ${{ github.event.pull_request.merged }} == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🔄 rsync deployments
uses: burnett01/rsync-deployments@5.2
with:
switches: -avzr --exclude=".git*" --filter="dir-merge,- .gitignore" --delete-after --progress ./ ./
path: ./*
remote_path: ${{ secrets.REMOTE_TARGET }}
remote_host: ${{ secrets.HOST }}
remote_port: ${{ secrets.PORT_PRODUCTION }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.PRIVATE_KEY }}
name: 🚧 Staging rsync deployment by SSH/SFTP
on:
push:
branches-ignore: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🔄 rsync deployments
uses: burnett01/rsync-deployments@5.2
with:
switches: -avzr --exclude=".git*" --filter="dir-merge,- .gitignore" --delete-after --progress ./ ./
path: ./*
remote_path: ${{ secrets.REMOTE_TARGET }}
remote_host: ${{ secrets.HOST }}
remote_port: ${{ secrets.PORT_STAGING }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.PRIVATE_KEY }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment