Skip to content

Commit

Permalink
Create deploy-react-app.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
htafolla authored Dec 21, 2023
1 parent 5ecf22f commit 59a0ad8
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy-react-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: React App Deployment # name of the workflo

on:
push:
branches:
- ft_checkers # branch name

jobs:
deploy-react-to-gh-pages:
runs-on: ubuntu-latest
env:
EXAMPLE: example # environment variable

steps:
# checkout the repository content to github runner
- name: Checkout
uses: actions/checkout@v2

# setup nodejs environment
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: "18.16.1"

# cache the dependencies to speed up the build
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# install dependencies
- name: Install dependencies
run: npm i

# build the react app
- name: Build
run: npm run build

# deploy the react app to github pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
# NOTE: GITHUB_TOKEN is a secret token that is automatically generated by GitHub
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build # directory to deploy

0 comments on commit 59a0ad8

Please sign in to comment.