feat: deploy web app to GitHub Pages
This commit is contained in:
64
.github/workflows/pages.yml
vendored
Normal file
64
.github/workflows/pages.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Build and deploy the web app to GitHub Pages.
|
||||
# Enable in repo: Settings → Pages → Source: GitHub Actions.
|
||||
# Site URL: https://<owner>.github.io/<repo>/
|
||||
|
||||
name: Deploy Web App to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "master"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "npm"
|
||||
|
||||
- name: Install root dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Prepare web app (index + skills)
|
||||
run: npm run app:setup
|
||||
|
||||
- name: Install web-app dependencies
|
||||
run: cd apps/web-app && npm ci
|
||||
|
||||
- name: Build web app for GitHub Pages
|
||||
run: cd apps/web-app && npm run build
|
||||
env:
|
||||
VITE_BASE_PATH: /${{ github.event.repository.name }}/
|
||||
|
||||
- name: SPA fallback for client-side routes
|
||||
run: cp apps/web-app/dist/${{ github.event.repository.name }}/index.html apps/web-app/dist/${{ github.event.repository.name }}/404.html
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@3
|
||||
with:
|
||||
path: apps/web-app/dist
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deploy.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deploy
|
||||
uses: actions/deploy-pages@4
|
||||
Reference in New Issue
Block a user