Add deploy_webapp.yml: build webapp/ to GitHub Pages

When webapp/ or this workflow changes on main, build the Vite app and
publish docs/app/ via the official GitHub Pages actions. Manual run via
workflow_dispatch is supported for backfill or first-time setup.

Pipeline:
  checkout → setup-node@v6 (Node 22, npm cache keyed on
  webapp/package-lock.json) → npm ci → npm run build → configure-pages →
  upload-pages-artifact (docs/app/) → deploy-pages.

Permissions limited to contents:read, pages:write, id-token:write
(required for the OIDC token deploy-pages uses). Concurrency group
'pages' with cancel-in-progress:false so two pushes in quick succession
both publish in order rather than dropping the earlier one.

One-time setup the repo owner needs to do: GitHub repo Settings → Pages
→ Source = 'GitHub Actions'. After that, every push to main that
touches webapp/ ships automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 4.7 committed 2026-05-04 08:07:02 +07:00
1 parent ab03edb211
commit cdfd8d3595
1 file changed
+60
+60
View File
@@ -0,0 +1,60 @@
name: Deploy webapp to GitHub Pages
on:
push:
branches: [main]
paths:
- 'webapp/**'
- '.github/workflows/deploy_webapp.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: webapp/package-lock.json
- name: Install dependencies
working-directory: webapp
run: npm ci
- name: Build webapp
working-directory: webapp
run: npm run build
- name: Configure GitHub Pages
uses: actions/configure-pages@v6
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/app
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5