Skip to content

Instantly share code, notes, and snippets.

@kaelri
Created May 11, 2022 14:55
Show Gist options
  • Save kaelri/d83405c9bca81aa26447b1540edec5e9 to your computer and use it in GitHub Desktop.
Save kaelri/d83405c9bca81aa26447b1540edec5e9 to your computer and use it in GitHub Desktop.
Use git-ftp to sync the latest commit’s files to an (S)FTP destination.
name: Publish to Production
on:
push:
branches: [ master ]
jobs:
web-deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/[email protected]
with:
fetch-depth: 10
- name: Sync Files
shell: bash
env:
FTP_URL: ${{secrets.PROD_FTP_URL}}
FTP_USERNAME: ${{secrets.PROD_FTP_USERNAME}}
FTP_PASSWORD: ${{secrets.PROD_FTP_PASSWORD}}
run: |
sudo apt-get update
sudo apt-get -qq install git-ftp
git ftp push --force --auto-init --verbose --syncroot ./ --user "$FTP_USERNAME" --passwd "$FTP_PASSWORD" --insecure "$FTP_URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment