Skip to content

Instantly share code, notes, and snippets.

@Shaxadhere
Last active August 21, 2023 08:14
Show Gist options
  • Save Shaxadhere/c2f5e9b7c68c4e47ac09c53168b6743f to your computer and use it in GitHub Desktop.
Save Shaxadhere/c2f5e9b7c68c4e47ac09c53168b6743f to your computer and use it in GitHub Desktop.
Deployment pipeline for react app to be deployed on cpanel via github actions, ftp and action secrets.
name: πŸš€ Deploy File to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: πŸŽ‰ Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache npm dependencies
uses: actions/cache@v3
id: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: πŸ”¨ Install Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
npm install
npm run build
git reset --hard
env:
CI: false
- name: πŸ“‚ Sync folders and files to the server
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: build/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment