Skip to content

chore: GitHub Actions #2

chore: GitHub Actions

chore: GitHub Actions #2

Workflow file for this run

name: Deploy
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets the GITHUB_TOKEN permissions 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
defaults:
run:
working-directory: frontend/react_app
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
- name: Install dependencies
uses: npm install
working-directory: ./frontend/react_app
- name: Build project
run: npm run build
working-directory: ./frontend/react_app
- name: Upload production-ready build files
uses: actions/upload-artifact@v3
working-directory: ./frontend/react_app
with:
name: production-files
path: ./dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
working-directory: ./frontend/react_app
with:
name: production-files
path: ./dist
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
working-directory: ./frontend/react_app
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist