Skip to content

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

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

Copy link
Copy Markdown
Contributor

Problem

release.yml publishes @contentstack/datasync-manager to npm with a long-lived NPM_TOKEN through JS-DevTools/npm-publish@v3, and attaches the tarball to the release with the archived actions/upload-release-asset@v1.

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 via JS-DevTools/npm-publish@v3 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
Permissions contents: write on the whole job contents: read on the publish job; contents: write only on the upload job
Release asset actions/upload-release-asset@v1 (archived) inside the publish job separate upload-release-asset job, runs after a successful publish: npm pack + gh release upload --clobber with the job token
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

Verification

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

Publish on release:published from release.yml so the npm trusted publisher can
be keyed on the filename, 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, and keep contents: write only on the job that needs it. The
tarball is attached to the release from a separate job with gh release upload
instead of the archived upload-release-asset action. 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 5, 2026 07:23
@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.

@github-actions

github-actions Bot commented Oct 5, 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 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

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

🔵 Needs a closer look

Release-tag shell injection remains unresolved, and external trusted-publishing prerequisites require verification.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Migrates DataSync’s npm release workflow from token authentication to OIDC trusted publishing.

Changes:

  • Publishes released versions using Node 24 and release-specific npm tags.
  • Separates tarball uploads into a job with write permissions.
  • Uses clean installs and checks out release tags without persisted credentials.
File Description
.github/​workflows/​release.yml Replaces token-based publishing and modernizes release asset uploads.

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

- name: Pack
run: npm pack
- name: Attach the tarball to the release
run: gh release upload "${{ github.event.release.tag_name }}" ./*.tgz --clobber
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