Skip to content

chore(release): publish to npm with trusted publishing - #73

Open
cs-raj wants to merge 4 commits into
developmentfrom
feat/DX-27614
Open

cs-raj wants to merge 4 commits into
developmentfrom
feat/DX-27614

Conversation

@cs-raj

@cs-raj cs-raj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

release.yml publishes @contentstack/webhook-listener to npm with a long-lived NPM_TOKEN.

The SE1 publishing policy requires OIDC trusted publishing instead: no token, a release.yml workflow that runs when a release is published, Node 24.

Fix

release.yml is rewritten in place. What changes inside it:

Before After
Trigger release: created release: published
npm auth NPM_TOKEN OIDC — id-token: write, no token
npm publish npm publish --tag latest --access public npm publish --access public; pre-releases go to the beta dist-tag, releases to latest
Node / npm 22.x / npm 10 24 / latest npm
Build npm run build-ts unchanged
Checkout release tag, credentials persisted release tag, persist-credentials: false
Actions checkout@v4, setup-node@v4 @v7
Tag check — publish stops if the release tag is not v + the package.json version
Release tarball attached by github-release.yml when it created the release upload-release-asset job in release.yml, after a successful publish (npm pack)
github-release.yml created the release with GITHUB_TOKEN on every version bump pushed to master removed — releases raised with that token cannot trigger release.yml; releases are created by a person

Verification

Node 22 and Node 24: install, build and npm pack all pass.

Publish on release:published so the npm trusted publisher keyed on release.yml
can be used, drop NODE_AUTH_TOKEN in favour of id-token: write (OIDC), run on
Node 24 with npm@latest (trusted publishing needs npm >= 11.5.1), check out the
release tag without persisted credentials, keep the explicit build-ts step.
GitHub pre-releases go to the beta dist-tag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:30
@cs-raj cs-raj self-assigned this Oct 1, 2026
@snyk-io

snyk-io Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The nonexistent actions/checkout@v7 and actions/setup-node@v7 references prevent the workflow from running.

Review effort: Balanced
Findings: None

What changed in this PR

Migrates npm releases from token authentication to OIDC trusted publishing.

Changes:

  • Publishes on release publication using Node 24 and OIDC.
  • Routes prereleases to beta and stable releases to latest.
  • Disables persisted checkout credentials.
File Description
.github/​workflows/​release.yml Updates the npm publishing workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Refuse to publish when the release tag is not "v" + the package.json version,
so a tag cut on the wrong commit cannot publish an older version under a
newer tag. The tag reaches the check through an env variable, never through
a shell line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Releases created with GITHUB_TOKEN will not trigger this publishing workflow.

1 open finding

🧠 Review effort: Balanced

Comment thread .github/workflows/release.yml
…e.yml

github-release.yml created the GitHub release with GITHUB_TOKEN on every
version bump pushed to master. Events raised by that token do not start other
workflows, so with publishing on release: published a bot-created release
would never run release.yml and npm would silently miss the version.
Releases are created by a person instead (as since v1.1.3), and release.yml
now attaches the npm pack tarball after a successful publish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 11:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The consolidated workflow correctly implements the stated release policy without unresolved issues.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Regenerated package-lock.json (clean npm install); no package.json change.

qs 6.15.3 -> 6.16.0 (via body-parser)
Fixes SNYK-JS-QS-19432017 and SNYK-JS-QS-19432019
Snyk: 2 medium findings -> 0

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The supply-chain workflow depends on external npm trusted-publisher configuration that cannot be validated from the repository.

0 open findings

🧠 Review effort: Balanced

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.

3 participants