Skip to content

Instantly share code, notes, and snippets.

@mahdyar
Created September 8, 2021 20:56
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mahdyar/2b99f57e30ce28a459dcc728a1893e68 to your computer and use it in GitHub Desktop.
Save mahdyar/2b99f57e30ce28a459dcc728a1893e68 to your computer and use it in GitHub Desktop.
Deploy to cPanel with GitHub Actions (FTP)
name: Deploy to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.1.0
with:
fetch-depth: 2
# Deploy to cPanel
- name: FTP-Deploy-Action
uses: SamKirkland/FTP-Deploy-Action@3.1.1
with:
ftp-server: ${{ secrets.FTP_SERVER }}
ftp-username: ${{ secrets.FTP_USERNAME }}
ftp-password: ${{ secrets.FTP_PASSWORD }}
# Purge CF's cache (optional)
- name: Purge cache
uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
@mahdyar
Copy link
Author

mahdyar commented Sep 8, 2021

You should create secrets FTP_SERVER, FTP_USERNAME and FTP_PASSWORD.

If your service is behind Cloudflare and you want to purge its cache with GitHub Actions as well, then you should create secrets CLOUDFLARE_ZONE and CLOUDFLARE_TOKEN, otherwise remove lines 21 to 26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment