Skip to content

ci(deploy): publish the React Storybook to GitHub Pages#30

Merged
ivanbanov merged 1 commit into
mainfrom
feat/deploy-storybook
Jul 19, 2026
Merged

ci(deploy): publish the React Storybook to GitHub Pages#30
ivanbanov merged 1 commit into
mainfrom
feat/deploy-storybook

Conversation

@ivanbanov

Copy link
Copy Markdown
Member

Summary

The Deploy workflow was an unfilled scaffold — it built a nonexistent website package under a /TODO-set-base-path/ placeholder, so nothing ever deployed. This points it at the React Storybook and ships it to GitHub Pages.

Changes

  • Build the Storybook, not a phantom site: pnpm build-storybook and upload packages/react/storybook-static.
  • Reuse ./.github/actions/ci-setup for the build job (git, pnpm, node from .nvmrc, frozen install) instead of hand-rolled setup steps.
  • Enable Pages from the workflow (actions/configure-pages with enablement: true) so the first deploy doesn't require a manual toggle in repo settings, and feed its base_path output into the build.
  • Honor a base path in Storybook (.storybook/main.tsviteFinal sets Vite base from BASE_PATH). The project site is served under /<repo>/ (e.g. https://dunky-dev.github.io/ui/), so the preview's assets must resolve there. Local pnpm dev / build-storybook leave BASE_PATH unset and stay at the root — no change to the local workflow.

Verification

BASE_PATH=/ui/ pnpm build-storybook locally:

  • iframe.html (Vite preview) → src="/ui/assets/iframe-*.js" — base applied ✓
  • index.html (manager) → relative refs (./sb-manager/…, ./favicon.svg) that resolve under any subpath ✓
  • Output at packages/react/storybook-static

That manager-relative + preview-based combination is what resolves correctly on a Pages project site.

Note

Pages has never been enabled on this repo (the API returns 404). enablement: true handles that on the first run; if org policy blocks programmatic enablement, it may need a one-time Settings → Pages → Source: GitHub Actions toggle. Deploy runs on push to main (and workflow_dispatch).

🤖 Generated with Claude Code

The Deploy workflow was an unfilled scaffold — it built a nonexistent
`website` package under a placeholder base path. Point it at the React
Storybook instead:

- Build via `pnpm build-storybook` and upload `packages/react/storybook-static`.
- Reuse the `ci-setup` action (git, pnpm, node from .nvmrc, frozen install).
- Enable Pages from the workflow (`configure-pages enablement: true`) so the
  first deploy needs no manual settings toggle, and feed its `base_path` to
  the build.
- Teach `.storybook/main.ts` to honor `BASE_PATH` via Vite's `base`, so the
  preview's assets resolve under the project subpath (e.g. /ui/); local dev
  and builds leave it unset and stay at the root.

Verified locally: `BASE_PATH=/ui/ pnpm build-storybook` emits iframe assets at
/ui/assets/… while the manager keeps relative refs, which is what resolves
correctly on a Pages project site.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ivanbanov
ivanbanov merged commit cb30578 into main Jul 19, 2026
6 checks passed
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