Skip to content

Deploy GitHub Pages #292

Deploy GitHub Pages

Deploy GitHub Pages #292

Workflow file for this run

name: Deploy GitHub Pages
# Builds the landing page (docs/index.html, via the locally vendored template at
# scripts/site/ — originally scaffolded from Developer-Tools-Directory's site-template,
# now owned and evolved by this repo) AND the local examples gallery
# (docs/gallery/index.html, generated from examples/gallery.json by scripts/build_gallery.py).
# Both ship in the single docs/ artifact; the landing build only writes docs/index.html +
# docs/fonts/ + docs/assets/, so it never clobbers docs/gallery/.
on:
push:
branches: [main]
paths:
- "skills/**"
- "rules/**"
- "site.json"
- ".cursor-plugin/plugin.json"
- "assets/**"
- "examples/**"
- "showcase/**"
- "docs/gallery/**"
- "scripts/build_gallery.py"
- "scripts/site/**"
- "CHANGELOG.md"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
# A push that will cut a release gets its deploy from release.yml, which dispatches
# this workflow after committing the version bump. Deploying on the push too only
# built a page that the dispatch then cancelled (8 of 9 push runs measured, #215).
# The pattern mirrors release.yml's "Determine bump type" step exactly. If that
# release fails, redeploy by hand: Actions > Deploy GitHub Pages > Run workflow.
gate:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.decide.outputs.deploy }}
steps:
- id: decide
env:
EVENT: ${{ github.event_name }}
COMMITS: ${{ toJSON(github.event.commits) }}
run: |
deploy=true
if [ "$EVENT" = "push" ] && echo "$COMMITS" \
| jq -r '.[].message | split("\n")[0]' \
| grep -qiE '^(feat|feature|fix)(\(.+\))?!?:|BREAKING[ -]CHANGE'; then
deploy=false
echo "Release-worthy push: release.yml dispatches Pages after the version bump."
fi
echo "deploy=$deploy" >> "$GITHUB_OUTPUT"
echo "deploy=$deploy"
build-and-deploy:
needs: gate
if: needs.gate.outputs.deploy == 'true'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# Full history: the landing page's "Recently added" dates come from
# the commit that first added each example (a shallow clone hides it).
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: pip install -r scripts/site/requirements.txt
- name: Build landing page (vendored template)
run: python scripts/site/build_site.py --repo-root . --out docs
- name: Build local examples gallery (from examples/gallery.json)
# Stdlib-only; regenerates docs/gallery/index.html so the committed page can never
# drift from gallery.json. The committed docs/gallery/assets/*.webp are untouched.
run: python scripts/build_gallery.py
- name: Check every internal link, anchor and image alt
run: python tests/check_site_links.py
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: docs
- uses: actions/deploy-pages@v5
id: deployment