Skip to content

Release pipeline hardening #328

Closed

Description

@dhensby

A few things in the release path could move the major tag to the wrong commit, or keep the release tools out of date.

The release job runs on every branch push. The release job's if checks the owner, event and actor, but not the branch (.github/workflows/release.yml#L178). .releaserc sets no branches, so semantic-release releases from any of its default branches: master, main, next, next-major, beta, alpha and N.x maintenance branches. misc/publish.sh accepts any version that starts with vX.Y.Z (misc/publish.sh#L10), prereleases included, and force-pushes vX (misc/publish.sh#L33-L39). A prerelease such as v5.0.0-beta.1 would move v5 to it. A release from next, or from a 4.N.x maintenance branch, would move v4 for every user.

publish.sh doesn't stop on errors. There is no set -e. If tar fails, the script still runs git rm -rf ./. If tar or cp fails, it commits a tree that holds only .gitignore and force-pushes the major tag. In CI the checkout is fresh and holds one tarball, so this works today. In a local clone with two tarballs in .package/, the tar glob fails, and the major tag would be force-pushed to a commit that holds only .gitignore (plus any untracked files that aren't ignored).

semantic-release isn't a dependency. npx semantic-release runs the copy that npm installed as a peer of the plugins. The lockfile records it as peer: true at 24.2.1, and Dependabot version updates don't touch it. semantic-release also loads @semantic-release/npm and @semantic-release/github from its own nested node_modules (12.0.2 and 11.0.1), not the direct dependencies (13.2.0 and 12.0.11). Dependabot bumps of those plugins, such as #320, therefore don't change what the release job runs.

Token and permissions. The release job keeps the checkout credentials, which it needs to push, and npm clean-install runs the prepare build before npm audit signatures runs (.github/workflows/release.yml#L193-L208). id-token: write isn't used, because .releaserc sets npmPublish: false.

Dependabot groups are stale (.github/dependabot.yml). release-tools lists semantic-release, which isn't a direct dependency. test-tools lists mocha, nyc and @istanbuljs/nyc-config-typescript, which the repo no longer uses. lint-tools lists @typescript-eslint/*, but the repo uses typescript-eslint, so those bumps arrive ungrouped.

Suggested fix:

  • Add github.ref == 'refs/heads/master' to the release job's if, and set branches: ['master'] in .releaserc.
  • In publish.sh, add set -euo pipefail, anchor the version check so prereleases are refused, and check that exactly one tarball exists before git rm.
  • Add semantic-release as a direct dev dependency, and run it with npx --no-install.
  • Remove id-token: write. Install with --ignore-scripts, run npm audit signatures, then build.
  • Update the Dependabot groups to match the current dependencies.

Activity

  1. added
    enhancement
    on Nov 19, 2026
  2. github-actions commented on Nov 21, 2026

    @github-actions

    🎉 This issue has been resolved in version 4.1.2 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions