Last active
August 21, 2023 08:14
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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