Skip to content

Deploy to GH Pages

Deploy to GH Pages #1

name: Deploy to GH Pages
on:
push:
branches:
- main
paths:
- "frontend/**"
# 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
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: "npm"
cache-dependency-path: "./frontend/package-lock.json"
- name: Install Dependencies and Build
run: "cd ./frontend && npm install && npm run build"
env:
VITE_FUNCTION_URL: ${{ secrets.VITE_FUNCTION_URL }}
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
name: frontend-dist # Set a name for the artifact
path: "./frontend/dist" # Upload the dist directory within /frontend
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
with:
artifact_name: frontend-dist