Skip to content

Commit

Permalink
Create GH Pages script
Browse files Browse the repository at this point in the history
  • Loading branch information
htafolla authored Dec 23, 2023
1 parent 3c16953 commit 742dd54
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main.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:
- final # 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/setup-node@v2.1.5
with:
node-version: "14.17.3"

# 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 742dd54

Please # to comment.