Skip to content

Instantly share code, notes, and snippets.

@anlisha-maharjan
Last active January 8, 2023 16:22
Show Gist options
  • Save anlisha-maharjan/7b940aa49c214a40e99dfe00c213198a to your computer and use it in GitHub Desktop.
Save anlisha-maharjan/7b940aa49c214a40e99dfe00c213198a to your computer and use it in GitHub Desktop.
Deploy React app on shared hosting with FTP Deploy GitHub Action.
name: ๐Ÿš€ Deploy on push master
on:
push:
branches:
- master
jobs:
web-deploy:
name: ๐ŸŽ‰ Deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: ๐Ÿšš Get latest code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
- name: Copy .env.prod.example to .env
run: cp .env.prod.example .env
- name: ๐Ÿ”จ Build Project
run: |
npm install
npm run build
- name: List output files
run: find build/ -print
- name: ๐Ÿ“‚ Sync files
uses: SamKirkland/FTP-Deploy-Action@4.3.3
with:
server: ${{ secrets.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