chore: modernize release pipeline with OIDC trusted publishing#20
Merged
Conversation
- Add `repository`, `homepage`, `bugs` fields to package.json. Required for npm provenance verification: npm cross-checks the workflow's origin against package.json.repository.url at publish time, and rejects the publish if they don't match. Without these fields the first trusted-publishing run would 422. - Bump `engines.node` from `>=10` (EOL since 2021) to `>=20`. Honest signal — CI runs on Node 20 and 22. - Patch/minor dev-dep bumps where the lockfile resolution stays clean: eslint 9.39.4, prettier 3.8.3, postcss 8.5.14, react/react-dom 19.2.6, @types/react 19.2.14, @babel/runtime 7.29.2 resolution. Held vitest at ^4.0.18 / vite at ^7.3.1 to keep yarn 1.x dependency linking working (vitest 4.1.x changed packaging in a way that triggers yarn 1 invariant violations on nested vite lookups). - Pin every GitHub Action by commit SHA in ci.yml, release.yml. Bumps checkout v6 -> v6.0.2, setup-node v6 -> v6.4.0, peter-evans/ create-pull-request v8 -> v8.1.1. Defense against tag-rewrite attacks. - Add workflow-level `permissions: contents: read` (default-deny) to ci.yml, release.yml. release.yml's job retains its explicit contents/pull-requests: write where it needs them. - New publish.yml: tag-triggered (v*) npm publish via OIDC Trusted Publishing with --provenance, gated behind the `npm-publish` GitHub environment for reviewer approval. Pre-release tags (vX.Y.Z-foo) route to the `next` dist-tag so they don't replace `latest`. Removes the need for a long-lived NPM_TOKEN. - Update release.yml PR body: removes the manual `npm publish` step, points at the new tag-driven publish flow. Pre-merge setup required before the first release tag is pushed: 1. npmjs.com -> Trusted publishers -> add `reearth/react-align` + workflow filename `publish.yml` + environment `npm-publish`. 2. GitHub -> Settings -> Environments -> create `npm-publish` with required reviewers. 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
Modernizes the release pipeline and dependency surface for this repo:
repository,homepage,bugsfields to package.json. npm cross-checksrepository.urlagainst the workflow's OIDC-asserted GitHub origin and rejects the publish if they don't match — without these fields, the first trusted-publishing release would 422.engines.nodebumped from>=10(EOL since 2021) to>=20. Honest signal; CI matrix already runs Node 20 and 22.vitestat^4.0.18andviteat^7.3.1— vitest 4.1.x changed packaging in a way that triggers yarn 1.x dependency linking invariant violations on nested vite lookups.ci.ymlandrelease.yml. Defense against tag-rewrite attacks. Versions bumped where newer was available:checkoutv6 → v6.0.2,setup-nodev6 → v6.4.0,peter-evans/create-pull-requestv8 → v8.1.1.permissions: contents: read) onci.ymlandrelease.yml. The release job retains its explicitcontents: write+pull-requests: writebecause it commits and opens PRs.publish.yml: tag-triggered (v*) npm publish via OIDC Trusted Publishing with--provenance, gated behind anpm-publishGitHub environment for reviewer approval. Pre-release tags (vX.Y.Z-foo) route to thenextdist-tag so they don't replacelatest. Removes the need for a long-livedNPM_TOKENand produces verifiable provenance attestations on every published tarball.release.ymlPR-body updated: removes the manualnpm publishstep, points reviewers at the new tag-driven publish flow.What changes for consumers
Nothing in the published package — this PR touches
.github/workflows/,package.jsonmetadata fields,engines.node, anddevDependenciesresolutions. None of those are in the package'sfilesfield. The next release published from this branch will be byte-identical to one published before it (modulo any code changes).After the first release goes out under the new flow, consumers can run
npm audit signaturesonreact-alignto verify the tarball was published by this repo's workflow at a specific commit, rather than from a maintainer's local machine.One-time pre-merge setup (before first tag push)
Configured on the npm + GitHub side, not in this PR:
react-alignpackage settings → Trusted publishers → add:reearthreact-alignpublish.ymlnpm-publishnpm-publishwith required reviewers.publish.ymlonly fires onv*tag push, so it's dormant after merge until the first release tag is pushed.Release flow after this lands
Releaseworkflow → pick version bump → it opens a release PRgit pull && git tag vX.Y.Z && git push origin vX.Y.ZPublishworkflow run pauses at thenpm-publishenvironment gate → approve →react-align@X.Y.Zships with provenanceTest plan
yarn lintpassesyarn type(tsc) passesyarn test --run— 6/6 tests passyarn buildproducesdist/react-align.{mjs,umd.js}and typesactionlintclean onpublish.ymlandci.yml(release.ymlhas 18 pre-existing shellcheck info-level warnings on lines this PR doesn't touch)vX.Y.Ztag → approve → first provenance-attested publish🤖 Generated with Claude Code