Skip to content

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

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 5, 2026

Copy link
Copy Markdown
Contributor

Problem

release.yml publishes @contentstack/datasync-content-store-mongodb to npm on every push to master, with a long-lived NPM_TOKEN through JS-DevTools/npm-publish@v2.2.0, then tries to create the GitHub release — a step that fails with 403 on every run because the job token is read-only.

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 push to master release: published — merging a version bump to master no longer publishes; creating the GitHub release does
npm auth NPM_TOKEN via JS-DevTools/npm-publish@v2.2.0 OIDC — id-token: write, no token, plain npm publish
npm publish action default npm publish --access public; pre-releases go to the beta dist-tag, releases to latest
Post-publish gh release create present (fails with 403) removed — the release is the trigger
Install npm install npm ci
Build npm run build-ts unchanged
Node / npm 22.x / npm 10 24 / latest npm
Checkout implicit, credentials persisted the release tag, persist-credentials: false
Actions checkout@v4, setup-node@v4 @v7
.nvmrc lts/* 24 — same Node as the publish job

Verification

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

Publish on release:published from release.yml instead of on every push to
master, so the npm trusted publisher can be keyed on the filename and a person
creating the GitHub release is what publishes; drop the NPM_TOKEN passed to
JS-DevTools/npm-publish 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. The post-publish gh release create step, which
fails with 403 under the read-only job token, goes away with the trigger.
GitHub pre-releases go to the beta dist-tag. .nvmrc pinned to 24.

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

snyk-io Bot commented Oct 5, 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

🟢 Approval recommended

The focused workflow changes correctly implement the stated trusted-publishing requirements without identified defects.

Review effort: Balanced
Findings: None

What changed in this PR

Updates npm publishing to use GitHub release-triggered OIDC trusted publishing.

Changes:

  • Targets Node.js 24 locally and in CI.
  • Replaces token-based publishing with npm OIDC authentication.
  • Publishes prereleases under beta and stable releases under latest.
File Description
.nvmrc Sets Node.js 24 as the development runtime.
.github/​workflows/​release.yml Implements release-triggered trusted npm publishing.

💡 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

The workflow references unpublished v7 action versions, preventing the publishing job from starting.

0 open findings

🧠 Review effort: Balanced

cs-raj and others added 2 commits October 24, 2026 19:36
Lock file regenerated (fixed 6 on its own: handlebars critical,
brace-expansion, browserslist, js-yaml high, baseline-browser-mapping
moderate, @babel/core low; all dev-only transitive).
Direct upgrades: none
Overrides: none
.talismanrc: package-lock.json checksum replaced by a
filecontent/base64content ignore so the regen does not trip Talisman.
Vuln count: snyk 0 → 0, npm audit 13 → 7. Build verified passing.
Remaining 7 moderate need majors (jest 30, node-notifier 11) or a
cross-major uuid; left for a separate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

1 similar comment
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security 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.

3 participants