Skip to content

fix: publish via npm trusted publisher (OIDC) - #261

Merged
allanbowe merged 1 commit into
mainfrom
npm-publish
Jul 21, 2026
Merged

fix: publish via npm trusted publisher (OIDC)#261
allanbowe merged 1 commit into
mainfrom
npm-publish

Conversation

@YuryShkoda

Copy link
Copy Markdown
Member

Issue

sasjs/utils publishes to npm via cycjimmy/semantic-release-action authenticated with a long-lived NPM_TOKEN secret. Long-lived publish tokens are a standing credential-leak risk.

Intent

Publish to npm using short-lived OIDC credentials instead of a static NPM_TOKEN, while keeping the same semantic-release versioning/changelog behavior.

Implementation

  • .github/workflows/publish.yml: replaced the cycjimmy/semantic-release-action step with a direct npx semantic-release call, and added an explicit npm publish --access public step that authenticates via OIDC (id-token: write permission, npm upgraded to latest since Node 22 ships npm 10.x and trusted publishing needs ≥ 11.5.1). A short-lived GitHub App token (secrets.APP_ID / APP_PRIVATE_KEY) is minted per run to check out the repo and push semantic-release's version-bump commit past branch protection, replacing secrets.GITHUB_TOKEN.
  • package.json: expanded the release config from a bare branches list to the explicit plugin pipeline (commit-analyzer, release-notes-generator, exec to bump the version, git to commit package.json/package-lock.json back, github for release notes) — the same pipeline cycjimmy/semantic-release-action ran implicitly, now made explicit since semantic-release is invoked directly. Added semantic-release, @semantic-release/exec, and @semantic-release/git as devDependencies.

Checks

  • Code is formatted correctly (npm run lint:fix).
  • All unit tests are passing (npm test).
  • All sasjs-cli unit tests are passing (npm test).
  • Reviewer is assigned.

Reviewer checks

  • Any new code is documented.

Replaces the NPM_TOKEN-based cycjimmy/semantic-release-action with a
GitHub App token (to push the release commit past branch protection)
and an explicit `npm publish` step authenticated via OIDC trusted
publishing.
@YuryShkoda
YuryShkoda requested a review from allanbowe July 21, 2026 12:24

@allanbowe allanbowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Closes #260 (hopefully)

@allanbowe
allanbowe merged commit 9388876 into main Jul 21, 2026
4 checks passed
@allanbowe
allanbowe deleted the npm-publish branch July 21, 2026 12:26
@sasjs-gha

sasjs-gha Bot commented Jul 21, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.5.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@sasjs-gha sasjs-gha Bot added the released label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants