Skip to content

ci: deploy Storybook to GitHub Pages#296

Closed
bdhyv wants to merge 1 commit into
mainfrom
bdh/storybook-github-pages
Closed

ci: deploy Storybook to GitHub Pages#296
bdhyv wants to merge 1 commit into
mainfrom
bdh/storybook-github-pages

Conversation

@bdhyv

@bdhyv bdhyv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Deploy Storybook workflow that builds packages/ui Storybook and publishes it to GitHub Pages at https://youversion.github.io/platform-sdk-react/
  • Auto-deploys on every push to main that touches packages/ui, packages/core, packages/hooks, or the lockfile; also supports manual runs via workflow_dispatch.
  • Reuses the existing STORYBOOK_YOUVERSION_APP_KEY Actions secret (app keys are public app identity, not secrets) and bakes the Pages URL in as STORYBOOK_AUTH_REDIRECT_URL.

Notes

  • Most stories run fully against MSW mocks, so the hosted site works without live API access.
  • One-time setup required before merge takes effect: in repo Settings → Pages, set the source to "GitHub Actions".
  • Live sign-in from the hosted Storybook additionally requires registering https://youversion.github.io/platform-sdk-react/ as a callback URL on the Storybook app; everything else works without it.

Test plan

  • pnpm build && pnpm build-storybook verified locally on main (static output in packages/ui/storybook-static/)
  • After merge + Pages enablement: confirm workflow run deploys and site loads at the Pages URL

Made with Cursor

Greptile Summary

This PR adds a GitHub Actions workflow that builds the packages/ui Storybook and publishes it to GitHub Pages at https://youversion.github.io/platform-sdk-react/, triggered on pushes to main that touch relevant packages or the lockfile.

  • The workflow correctly uses actions/upload-pages-artifact and actions/deploy-pages with the appropriate pages: write and id-token: write permissions, and the concurrency block prevents overlapping deployments.
  • STORYBOOK_AUTH_REDIRECT_URL is intentionally hardcoded to the Pages URL (instead of using a secret as in storybook.yml), which is a deliberate and documented choice.
  • The setup-node step omits cache: 'pnpm' that every other workflow in the repo includes, causing a full dependency re-download on each deploy.

Confidence Score: 4/5

Safe to merge once the one-time GitHub Pages source setting is configured in repo Settings.

The workflow is well-structured and consistent with the rest of the repo's CI patterns. The only gap is the missing pnpm cache on the setup-node step, which makes every deploy slower but does not affect correctness or security. Permissions are scoped correctly, concurrency is handled properly, and the build steps mirror what is done in other workflows.

.github/workflows/deploy-storybook.yml — the only changed file; minor cache configuration inconsistency.

Important Files Changed

Filename Overview
.github/workflows/deploy-storybook.yml New workflow to build and publish Storybook to GitHub Pages on pushes to main; missing pnpm cache configuration that every other workflow in the repo uses.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant GH as GitHub (push to main)
    participant WF as deploy-storybook workflow
    participant Runner as ubuntu-latest runner
    participant Pages as GitHub Pages

    GH->>WF: push event (packages/ui, core, hooks, or lockfile)
    WF->>Runner: checkout + install pnpm
    Runner->>Runner: pnpm install --frozen-lockfile
    Runner->>Runner: pnpm build (all packages)
    Runner->>Runner: "cd packages/ui && pnpm build-storybook"
    Note over Runner: STORYBOOK_YOUVERSION_APP_KEY (secret)<br/>STORYBOOK_AUTH_REDIRECT_URL (hardcoded Pages URL)
    Runner->>Pages: upload-pages-artifact (storybook-static/)
    Pages-->>Runner: artifact id
    Runner->>Pages: deploy-pages
    Pages-->>WF: page_url output
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant GH as GitHub (push to main)
    participant WF as deploy-storybook workflow
    participant Runner as ubuntu-latest runner
    participant Pages as GitHub Pages

    GH->>WF: push event (packages/ui, core, hooks, or lockfile)
    WF->>Runner: checkout + install pnpm
    Runner->>Runner: pnpm install --frozen-lockfile
    Runner->>Runner: pnpm build (all packages)
    Runner->>Runner: "cd packages/ui && pnpm build-storybook"
    Note over Runner: STORYBOOK_YOUVERSION_APP_KEY (secret)<br/>STORYBOOK_AUTH_REDIRECT_URL (hardcoded Pages URL)
    Runner->>Pages: upload-pages-artifact (storybook-static/)
    Pages-->>Runner: artifact id
    Runner->>Pages: deploy-pages
    Pages-->>WF: page_url output
Loading

Fix All in Claude Code Fix All in Cursor Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/workflows/deploy-storybook.yml:37-39
The `setup-node` step is missing `cache: 'pnpm'`, which every other workflow in this repo includes (see `ci.yml`). Without it, pnpm's module store is not cached between runs, so every deploy does a full network re-download of all dependencies. Adding it keeps this workflow consistent and meaningfully cuts wall-clock time.

```suggestion
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: 'pnpm'
```

Reviews (1): Last reviewed commit: "ci: deploy Storybook to GitHub Pages on ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7886a00

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +37 to +39
- uses: actions/setup-node@v6
with:
node-version: 24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The setup-node step is missing cache: 'pnpm', which every other workflow in this repo includes (see ci.yml). Without it, pnpm's module store is not cached between runs, so every deploy does a full network re-download of all dependencies. Adding it keeps this workflow consistent and meaningfully cuts wall-clock time.

Suggested change
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'pnpm'
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/deploy-storybook.yml
Line: 37-39

Comment:
The `setup-node` step is missing `cache: 'pnpm'`, which every other workflow in this repo includes (see `ci.yml`). Without it, pnpm's module store is not cached between runs, so every deploy does a full network re-download of all dependencies. Adding it keeps this workflow consistent and meaningfully cuts wall-clock time.

```suggestion
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: 'pnpm'
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Cursor Fix in Codex

@bdhyv

bdhyv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by a GitHub Pages deployment for the standalone Vite demo app.

@bdhyv bdhyv closed this Jul 21, 2026
@bdhyv bdhyv mentioned this pull request Jul 21, 2026
4 tasks
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