Publish the demo to GitHub Pages - #12
Merged
Merged
Conversation
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`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds the demo on every push to
mainand 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.mjsnow takes its base fromDEMO_BASE, which only the workflow sets:Development and the Playwright suite leave it unset and stay at the root, where
playwright.config.ts'sbaseURLand everypage.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
/vanillaand the vanilla page's link back. Both now go throughwithBase()in the newdemo/src/base.ts, which is correct at either base.Permissions
pages: writeandid-token: writelive on the deploy job alone. The build job andci.ymlkeepcontents: read. The two Pages actions are pinned to commit SHAs, like the rest.Verified
DEMO_BASE=/lightboxand served under/lightbox/: both pages load, both lightboxes open, both cross-links resolve, no failed requests.npm run typecheckclean, andnpm testpasses (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.