Skip to content

Deploy gallery

Deploy gallery #4

# Deploys the gallery site (site/) to GitHub Pages.
#
# One-time setup: enable GitHub Pages in the repo settings with
# "GitHub Actions" as the source. After that, every merge to main that
# touches the examples, the site, or hub.config.json rebuilds and
# redeploys the gallery, so new examples show up on their own. The
# manual trigger stays around for one-off redeploys.
name: Deploy gallery
on:
push:
branches: [main]
paths:
- "catalog/**"
- "examples/**"
- "site/**"
- "hub.config.json"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
cache-dependency-path: site/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: site
- name: Build site
run: npm run build
working-directory: site
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: site/dist
# Per-attempt name so re-running a failed run doesn't collide
# with the previous attempt's artifact.
name: github-pages-${{ github.run_attempt }}
- id: deployment
uses: actions/deploy-pages@v5
with:
artifact_name: github-pages-${{ github.run_attempt }}