chore: Port the v5 publish workflow to main#413
Merged
Conversation
Replace the GitHub-templated stub with a project-specific policy: support matrix tied to the @chakra-ui/react major peer (v5/v6 supported, v4 and earlier not), private reporting via GitHub Security Advisories, and pointers to react-select / Chakra UI for upstream issues. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adopts the e18e publishing recommendations on main, mirroring the v5 setup from #405: - Add .github/workflows/publish.yml with the three-job test → build → publish flow. OIDC trusted publishing with provenance attestations; no npm tokens. Top-level permissions: {}, persist-credentials: false, pinned action SHAs, --ignore-scripts on install, Node 24 throughout. - Replace v5's hardcoded --tag chakra2 with a conditional: stable releases publish to `latest`, GitHub-flagged prereleases publish to `next`. - Add `pnpm test` to the test job (v5 omitted it because the test suite didn't exist there yet; on main it does). - Drop `prepublishOnly` and `postpublish` from package.json — CI publishes from a pre-built tarball, and the equivalent gating now lives in the publish workflow's test job. - Drop `.npmrc ignore-scripts=true`. pnpm's `allowBuilds` whitelist (pnpm-workspace.yaml) already gates dependency install scripts with finer granularity, and the publish workflow passes --ignore-scripts to `pnpm install` explicitly. Removing the blanket flag lets husky's `prepare` script run automatically on fresh installs. - Update CONTRIBUTING.md to reflect the install-scripts model change, and remove the now-obsolete .npmrc → ini files.associations entry from .vscode/settings.json. Before the first publish from main, the GitHub `publish` environment will need `main` added to its allowed-branches list alongside `v5`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
commit: |
📊 Package size report -0.07%↓
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
1 task
csandman
added a commit
that referenced
this pull request
May 16, 2026
Removing .npmrc's ignore-scripts=true in #413 had an unintended consequence: `npm pack` now runs the project's own `prepare` script (husky), which dumps lifecycle output to stdout. With TARBALL=$(npm pack), that output gets captured alongside the tarball filename, producing a multi-line value that breaks $GITHUB_OUTPUT's key=value\n format and fails the build job. pnpm's `allowBuilds` whitelist only gates *dependency* install scripts; it doesn't suppress the project's own scripts during `npm pack`. Adding --ignore-scripts to the pack invocation restores clean stdout. Husky's `prepare` doesn't need to run during CI pack anyway — git hooks aren't relevant in the ephemeral runner. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Brings
mainto parity with v5's publishing setup from #405, adapted for the post-stable release flow on this branch. Three commits:docs: fill out SECURITY.md— replaces the GitHub-templated stub with a real policy: support matrix tied to the@chakra-ui/reactmajor peer (v5/v6 supported, v4 and earlier not), private reporting via GitHub Security Advisories, out-of-scope pointers to react-select / Chakra UI.Downgrade codemod types/node— incidental: aligns the dev type to the locally installed Node version.chore: Port the v5 publish workflow to main— the main event.Publish workflow (
.github/workflows/publish.yml)Three-job
test→build→publishflow scaffolded from@e18e/setup-publishper the e18e publishing guide, copied verbatim from v5 with two adjustments:--tag chakra2. On main, stable releases publish tolatest; GitHub-flagged prereleases publish tonext:env:indirection to avoid the template-injection class that zizmor flags.pnpm testadded to the test job: v5 omitted it because the test suite didn't exist there at the time of chore: Adopt e18e publishing practices (OIDC trusted publishing + provenance) (v5) #405. On main (PR Add an integration test suite #412) it does, and dropping that gate when migrating fromprepublishOnlyto CI would be a regression.Security baseline (per e18e hardening):
permissions: {}; each job opts in minimally (contents: readon test/build,id-token: writeonly on publish).persist-credentials: falseon every checkout.pnpm install --frozen-lockfile --ignore-scriptsin every job.publishhasid-token: write. The publish job is scoped toenvironment: publishfor an approval gate.Departure from v5: drop
.npmrc ignore-scripts=truev5 ships
.npmrcwithignore-scripts=trueper the e18e tip. This PR removes it on main, because the protection it provides is now covered better by pnpm'sallowBuildswhitelist (onlyesbuildis permitted to run install scripts). The publish workflow still passes--ignore-scriptstopnpm installexplicitly, which is the load-bearing protection for the high-stakes publish path.Removing the blanket setting lets husky's
preparescript run automatically on fresh clones — no morepnpm preparerake.Updates that fall out:
pnpm preparenote with one pointing atallowBuildsas the dep-script gate..npmrc→inifile association.package.jsonscript cleanupTwo scripts are obsolete under CI-driven publishing (per #405's rationale):
prepublishOnly: "pnpm build && pnpm lint && pnpm test"— CI publishes from a pre-built tarball, which doesn't run local lifecycle scripts. The equivalent gating now lives in the publish workflow'stestjob (withpnpm testadded — see above).postpublish: "git push --follow-tags"— CI shouldn't push tags. The intended flow ispnpm versionlocally →git push --follow-tags→ create GitHub release → workflow fires.Pre-flight checklist (manual setup outside the repo)
These must be in place before the first publish from main, or the workflow will fail at the publish step:
publish— addmainto allowed-branches alongsidev5(Settings → Environments → publish). Per e18e guidance, hardcode exact branch names; do not use patterns.publish.yml+ environmentpublishat https://www.npmjs.com/package/chakra-react-select/access. Per-workflow/environment binding should already cover main; check that the entry exists.v*— already in place from v5 setup.Release flow after merge
pnpm version <patch|minor|major>onmain→git push --follow-tags origin main.publishenvironment deployment.npm dist-tag ls chakra-react-selectshowslatestupdated;chakra2andnextunchanged.npm view chakra-react-select@<version> --jsonshowsdist.attestationspopulated.Test plan
lint,test(Node 20 & 24),pkg-pr,zizmor,package-size-reportall green.zizmoris the key check — it lints the newpublish.ymlfor template injection, excessive permissions, unpinned actions. Any flags here should be fixed before merge.publishworkflow itself does not run on this PR — it triggers only onrelease: published. Expected.🤖 Generated with Claude Code