Skip to content

Deploy GitHub Pages #18

Deploy GitHub Pages

Deploy GitHub Pages #18

Workflow file for this run

name: Deploy GitHub Pages
# Builds the docs/ static site and deploys it to GitHub Pages. Triggers on push
# to main that touches docs/** (or this workflow file), plus a manual
# workflow_dispatch button. The build is deterministic: it runs bash docs/build.sh
# and uploads the resulting docs/ directory as the Pages artifact.
on:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/pages.yml"
workflow_dispatch:
schedule:
# Weekly rebuild on a quiet hour keeps the published site, its Pages cache,
# and any CDN edges in sync even when nothing under docs/** has changed
# for a while. Sundays 07:00 UTC is off-peak for BC Gov maintainers.
- cron: "0 7 * * 0"
# Deny-all baseline at the workflow scope; jobs opt into the minimum scopes they
# need. Build only reads the repo; deploy is the only job that needs the elevated
# Pages permissions (pages:write to publish, id-token:write for the OIDC-signed
# environment URL on actions/deploy-pages@v5).
permissions: {}
# Allow only one Pages deployment at a time. Don't cancel in-flight runs —
# letting them finish keeps the deployment history honest.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24"
- name: Build documentation
run: |
set -euo pipefail
cd docs
chmod +x build.sh
./build.sh
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs
deploy:
needs: build
runs-on: ubuntu-24.04
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5