Repository navigation
ci: harden the release pipeline - #338
Merged
Merged
Conversation
The release job ran on a push to any branch, and .releaserc set no branches, so semantic-release would release from any of its default release branches (master, main, next, next-major, beta, alpha and N.x maintenance branches). publish.sh then moves the major tag, so a release from one of those branches would move the tag that every user runs. Run the release job only for pushes to master, and set master as the only release branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The version check only required the argument to start with vX.Y.Z, so a prerelease such as v5.0.0-beta.1 passed, and the script then moved the v5 tag to it. Anchor the check so that only a full release version passes, and take the major version from the match. Also correct the action name in the header comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
publish.sh had no `set -e` and checked no exit codes. When `tar` failed, for example because the glob matched two tarballs in .package/, the script still removed every file, committed a tree that held only .gitignore, and force-pushed the major tag. In CI the checkout is fresh and holds one tarball, so this hasn't happened yet, but a local run with a stale tarball in .package/ would break the tag for every user. Stop at the first failure, use the tarball for the exact version being released, and check that the package has action.yml and the bundle before anything in the tree changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
semantic-release wasn't in package.json. The release job ran the copy that npm had installed as a peer of the plugins, locked at 24.2.1, and Dependabot never updated it. That copy also loaded its own nested @semantic-release/npm 12.0.2 and @semantic-release/github 11.0.1, so the Dependabot bumps of the direct plugins never reached the release job. Because the plugins were dev dependencies, every development install also included semantic-release and its tree. Move semantic-release and its plugins out of the main package into their own package and lockfile in .github/release, which only the release job installs. semantic-release is now 25.0.9 (version 26 needs Node 26.13 or later, so it can't run on Node 24), and its plugins resolve to the copies in the same lockfile. The conventionalcommits preset is added there at 8.0.0, the version that releases use today, so that the release notes don't change. A development install drops from 907 to 255 packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ase job The release job ran `npm clean-install`, which runs the `prepare` build and any dependency install scripts, before `npm audit signatures` checked the packages. Code from a tampered package could therefore run in the job, with its write token, before the check. Install both the main package and the release tools without scripts, and verify the registry signatures of each lockfile before semantic-release runs. No build is lost: when semantic-release prepares a release, `npm version` and `npm pack` run the `version` and `prepare` scripts, which build lib/. Include the release tools' lockfile in the npm cache key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release job asked for id-token: write for npm provenance, but .releaserc sets npmPublish: false. @semantic-release/npm requests an OIDC token only when it verifies npm auth, and it skips that when npmPublish is false, so the job never used the permission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test-tools group listed mocha, nyc and the nyc TypeScript config, which the repo no longer uses. lint-tools listed @typescript-eslint/*, but the repo uses the typescript-eslint package, so those bumps arrived one PR at a time, as did the rollup bumps. Remove test-tools, match eslint, @eslint/* and typescript-eslint in lint-tools, and add a build-tools group for rollup and its plugins. Also ignore major @types/node updates, because the action runs on Node 24; two such PRs have already been closed by hand. Check the release tools' package in .github/release as well, so that semantic-release and its plugins stay up to date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhensby
force-pushed
the
ci/release-pipeline
branch
from
November 20, 2026 20:21
09facf9 to
caadd0c
Compare
dhensby
marked this pull request as ready for review
November 20, 2026 20: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.
This hardens the release path, so that a release can't move the major tag to the wrong commit and the release tools stay up to date.
master. The release job ran on a push to any branch, and.releasercset nobranches, so semantic-release would release from any of its default branches (next,beta,alpha,N.xand others). The job now runs only for pushes tomaster, andmasteris the only release branch.publish.shrefuses prereleases. The version check is anchored, so only a fullvX.Y.Zpasses, and the major version comes from the match.publish.shstops on errors. Withset -euo pipefail, the script uses the tarball for the exact version being released, and it checks that the package hasaction.ymland the bundle before it changes anything. I tested it in scratch clones with a bareorigin. It refuses a prerelease, a missing argument, a missing tarball and a package withoutlib/, and it leaves the tree as it was. It picks the right tarball when a stale one is also present. With two tarballs, the old script exited 0 and force-pushed av4that held only.gitignore.@semantic-release/npm12.0.2 and@semantic-release/github11.0.1, so the Dependabot bumps of those plugins (for example chore(deps-dev): bump @semantic-release/github from 12.0.10 to 12.0.11 in the release-tools group #320) never reached releases. Because the plugins were dev dependencies, every development install also included semantic-release. semantic-release and its plugins now have their ownpackage.jsonand lockfile in.github/release/, which only the release job installs. A development install drops from 907 to 255 packages. semantic-release is now 25.0.9, and its plugins resolve to the copies in the same lockfile (npm 13.2.0, github 12.0.11). Version 26 needs Node 26.13 or later, so it can't run on Node 24. Theconventionalcommitspreset is pinned there at 8.0.0, the version that releases use today, so the release notes don't change (Remove the temporary conventional-changelog-conventionalcommits override #339 covers updating it).npm audit signatureschecks each lockfile before semantic-release runs, so no dependency code runs before the check. semantic-release still buildslib/through theversionandpreparescripts when it prepares a release.id-token: writeis removed..releasercsetsnpmPublish: false, so the npm plugin never requests an OIDC token.test-toolsgroup (mocha, nyc).lint-toolsnow matchestypescript-eslintand@eslint/*, and a newbuild-toolsgroup covers rollup and its plugins. Major@types/nodeupdates are ignored, to match the Node 24 runtime. Dependabot also checks the release tools in.github/release/.A Dependabot PR that bumps semantic-release to 26 would pass every PR check and then fail the next release, because the release job runs only on
master. For now, such a PR must not be merged.I ran semantic-release from
.github/release/as a dry run in a scratch clone with a localorigin. Every plugin loaded, and with a testfix:commit it computed 4.1.2 and wrote the notes in theconventionalcommitsformat. The release job doesn't run on pull requests, so the first push tomasterafter the merge is its real test. Every commit since v4.1.1 uses a non-release type, so that run should check the configuration and then report that no release is due.Closes #328
🤖 Generated with Claude Code