Skip to content

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

Open
cs-raj wants to merge 1 commit into
developmentfrom
feat/DX-27614
Open

cs-raj wants to merge 1 commit into
developmentfrom
feat/DX-27614

Conversation

@cs-raj

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

Copy link
Copy Markdown
Contributor

Problem

npm-publish.yml publishes @contentstack/delivery-sdk 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.

The GitHub Packages job also authenticates with a personal token (PKG_TOKEN) and lacks the packages: write permission.

Fix

npm-publish.yml is renamed to release.yml. 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
GitHub Packages PKG_TOKEN (personal token), no packages: write github.token with packages: write
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
package.json no repository field names this repo (provenance validation requires it)

Verification

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

Publish on release:published from release.yml so the npm trusted publisher can
be keyed on the filename, 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. GitHub pre-releases go
to the beta dist-tag. The GitHub Packages job gains the packages: write
permission it was missing and publishes with the job's own token instead of a
personal token. package.json gains the repository field that provenance
validation requires.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 08:42
@cs-raj
cs-raj requested review from a team as code owners October 1, 2026 08:42
@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.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 98.9% 993/1004
🟢 Branches 96.52% 305/316
🟢 Functions 97.79% 221/226
🟢 Lines 99.37% 945/951

Test suite run success

720 tests passing in 36 suites.

Report generated by 🧪jest coverage report action from 43f0338

@github-actions

github-actions Bot commented Oct 1, 2026

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 2 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

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 2
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

GitHub Packages currently promotes prereleases under the latest dist-tag.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Migrates package releases to OIDC trusted publishing and improves GitHub Packages authentication.

Changes:

  • Replaces token-based npm authentication with OIDC.
  • Uses Node 24 and release-aware npm dist-tags.
  • Adds repository metadata for provenance validation.
File Description
package.json Adds repository metadata.
.github/​workflows/​release.yml Introduces trusted publishing workflows.
.github/​workflows/​npm-publish.yml Removes the legacy token-based workflow.

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

- name: Update npm
run: npm install -g npm@latest
- name: Release
run: npm publish
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.

2 participants