Skip to content

ci: harden the release pipeline - #338

Merged
dhensby merged 7 commits into
tediousjs:masterfrom
dhensby:ci/release-pipeline
Nov 20, 2026
Merged

dhensby merged 7 commits into
tediousjs:masterfrom
dhensby:ci/release-pipeline

Conversation

@dhensby

@dhensby dhensby commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • Release only from master. 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 branches (next, beta, alpha, N.x and others). The job now runs only for pushes to master, and master is the only release branch.
  • publish.sh refuses prereleases. The version check is anchored, so only a full vX.Y.Z passes, and the major version comes from the match.
  • publish.sh stops on errors. With set -euo pipefail, the script uses the tarball for the exact version being released, and it checks that the package has action.yml and the bundle before it changes anything. I tested it in scratch clones with a bare origin. It refuses a prerelease, a missing argument, a missing tarball and a package without lib/, 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 a v4 that held only .gitignore.
  • Release tools in their own lockfile. The release job ran a copy of semantic-release that npm installed as a peer of the plugins (24.2.1), which Dependabot never updated. That copy loaded its own nested @semantic-release/npm 12.0.2 and @semantic-release/github 11.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 own package.json and 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. The conventionalcommits preset 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).
  • Install order in the release job. Both installs now skip scripts, and npm audit signatures checks each lockfile before semantic-release runs, so no dependency code runs before the check. semantic-release still builds lib/ through the version and prepare scripts when it prepares a release.
  • Permissions. id-token: write is removed. .releaserc sets npmPublish: false, so the npm plugin never requests an OIDC token.
  • Dependabot groups. I removed the stale test-tools group (mocha, nyc). lint-tools now matches typescript-eslint and @eslint/*, and a new build-tools group covers rollup and its plugins. Major @types/node updates 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 local origin. Every plugin loaded, and with a test fix: commit it computed 4.1.2 and wrote the notes in the conventionalcommits format. The release job doesn't run on pull requests, so the first push to master after 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

dhensby and others added 3 commits November 20, 2026 11:19
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>
dhensby and others added 4 commits November 20, 2026 20:20
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
dhensby force-pushed the ci/release-pipeline branch from 09facf9 to caadd0c Compare November 20, 2026 20:21
@dhensby
dhensby marked this pull request as ready for review November 20, 2026 20:21
@dhensby
dhensby merged commit cb2ed7b into tediousjs:master Nov 20, 2026
5 checks passed
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.

Release pipeline hardening

1 participant