Skip to content

Publish the demo to GitHub Pages - #12

Merged
TokyoDanInJapan merged 1 commit into
mainfrom
feat/pages-demo
Aug 2, 2026
Merged

Publish the demo to GitHub Pages#12
TokyoDanInJapan merged 1 commit into
mainfrom
feat/pages-demo

Conversation

@TokyoDanInJapan

Copy link
Copy Markdown
Owner

Builds the demo on every push to main and deploys it to GitHub Pages, so the transitions can be seen without a checkout and two installs. It will be served at https://tokyodaninjapan.github.io/lightbox/.

The base path

Pages serves a project site from a subpath. demo/astro.config.mjs now takes its base from DEMO_BASE, which only the workflow sets:

const base = process.env.DEMO_BASE ?? '/'

Development and the Playwright suite leave it unset and stay at the root, where playwright.config.ts's baseURL and every page.goto('/') in the specs already point. No test changes were needed.

Astro rewrites the paths it generates, but not the two written by hand - the React page's link to /vanilla and the vanilla page's link back. Both now go through withBase() in the new demo/src/base.ts, which is correct at either base.

Permissions

pages: write and id-token: write live on the deploy job alone. The build job and ci.yml keep contents: read. The two Pages actions are pinned to commit SHAs, like the rest.

Verified

  • Built with DEMO_BASE=/lightbox and served under /lightbox/: both pages load, both lightboxes open, both cross-links resolve, no failed requests.
  • Built without it: npm run typecheck clean, and npm test passes (52 unit, 10 Playwright).

After merging

Pages needs enabling once, with the source set to GitHub Actions. Note the demo's photographs come from picsum.photos, so the published demo depends on that service being up.

The demo is the only way to see what a transition actually looks like, and
it has needed a checkout and two npm installs to reach. A workflow now
builds it on every push to main and deploys it to Pages, at
tokyodaninjapan.github.io/lightbox.

Pages serves a project site from a subpath, so the build takes its base
from `DEMO_BASE`, which only the workflow sets. Development and the
Playwright suite leave it unset and stay at the root, where `baseURL` and
every `page.goto('/')` in the specs already point.

Astro rewrites the paths it generates, but not the two written by hand:
the React page's link to /vanilla and the vanilla page's link back. Both
now go through `withBase`, which is correct at either base. Verified by
serving the built site under /lightbox/ and clicking through both pages
and their lightboxes.

The deploy job holds the `pages: write` and `id-token: write` it needs;
the build job and ci.yml keep `contents: read`.
@TokyoDanInJapan
TokyoDanInJapan merged commit 60b09bb into main Aug 2, 2026
1 check passed
@TokyoDanInJapan
TokyoDanInJapan deleted the feat/pages-demo branch August 2, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant