fix(ci): repair Publish workflow — native Pages deploy + automated npm publish#22
Merged
Conversation
…m publish The previous Publish workflow had two unrelated issues that both broke for the v0.2.6 release: 1. Storybook-to-Pages step depended on bitovi/github-actions-storybook-to-github-pages@v1.0.2, which internally pulls actions/upload-artifact@v3 — disabled by GitHub. The v0.2.6 publish run failed immediately at setup, leaving the GitHub Pages Storybook on the prior build. 2. The npm publish block was commented out and full of placeholders (your-scope, YOUR_NPM_AUTH_TOKEN), so npm releases had to be done manually. This rewrite splits the workflow into two independent jobs: - storybook-pages: builds Storybook and deploys to GitHub Pages using native actions (actions/configure-pages@v5, actions/upload-pages- artifact@v3, actions/deploy-pages@v4). No third-party action. The pages concurrency group prevents parallel deploys stepping on each other while still letting an in-flight deploy finish. - npm-publish: builds and runs `npm publish --provenance --access public`, gated on github.event_name == 'release' so manual workflow_dispatch runs (e.g. to re-deploy Pages) don't try to re-publish the same version. Uses the NPM_TOKEN secret; provenance is enabled to link the published tarball back to the GitHub release via OIDC. The job declares id-token: write at the job level for provenance signing. NPM_TOKEN secret must be added to the repo by the owner before the next release — instructions in the PR description. Closes #21
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.
Summary
Fixes both problems that surfaced while shipping v0.2.6:
bitovi/github-actions-storybook-to-github-pages@v1.0.2internally pullsactions/upload-artifact@v3, which GitHub disabled. The v0.2.6 publish run failed at setup (log) and the GH Pages Storybook is stuck on the pre-v0.2.6 build.publish.ymlwas commented out and full of placeholders. v0.2.6 had to be published manually.Changes
.github/workflows/publish.ymlrewritten as two independent jobs:storybook-pagesactions/configure-pages@v5actions/upload-pages-artifact@v3actions/deploy-pages@v4pageswithcancel-in-progress: falseso an in-flight deploy can finish before the next one startsnpm-publishnpm publish --provenance --access publicgithub.event_name == 'release'so manualworkflow_dispatchruns (e.g. just to re-deploy Pages) won't try to re-publish the same versionNPM_TOKENid-token: writeat the job level so npm provenance attestations can be signed via GitHub OIDCRequired before next release: add
NPM_TOKENsecretThe
npm-publishjob depends on a repo secret calledNPM_TOKEN. Without it the job will fail authentication. Steps for the repo owner:react-resize-detector-context, permission: Read and write, expiry: 1 year is reasonablenpm_…)NPM_TOKENOnce that's set, the next
release: publishedevent will trigger the workflow end-to-end.Test plan
After merging:
Publishworkflow viaworkflow_dispatch(Actions tab → Publish → Run workflow → main) to verify thestorybook-pagesjob runs green and Pages updates to current Storybook 10 build.npm-publishwill be skipped (no release event).Notes
huskydevDep /.husky/directory cleanup (separate concern, mentioned in fix(ci): repair Publish workflow — native GitHub Pages deploy + automated npm publish #21 as a follow-up).Closes #21