Skip to content

Deploy React site to Page #4

Deploy React site to Page

Deploy React site to Page #4

Workflow file for this run

# Workflow for building and deploying a React site to GitHub Pages
name: Deploy React site to Page
on:
create:
tags:
- 'v*'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install dependencies
run: yarn install
- name: Build React App
run: CI=false yarn build
- name: Setup Pages
id: pages
uses: actions/configure-pages@v1
- name: Upload artifact
# This will automatically upload an artifact from the 'build' directory
uses: actions/upload-pages-artifact@v1
# if: ${{ success() && github.ref == 'refs/heads/main' }}
with:
path: ./build/
# Deployment job
deploy:
name: deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
# if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
if: ${{ success() }}