Skip to content

ci(release): switch to npm trusted publisher (OIDC) — no NPM_TOKEN - #35

Merged
miloshevb merged 2 commits into
mainfrom
ci/release-trusted-publisher-oidc
Oct 16, 2026
Merged

miloshevb merged 2 commits into
mainfrom
ci/release-trusted-publisher-oidc

Conversation

@adrian-bobev

Copy link
Copy Markdown
Contributor

Why

The release workflow's Verify auth (dry-run only) step was failing with EINVALIDNPMTOKEN — see run 38875275562. Root cause: @semantic-release/npm@12.0.2 runs npm whoami in verifyConditions, which requires a long-lived token identity and cannot be satisfied by OIDC trusted publishing.

Additionally, the release colleagues flagged that our npmjs.com trusted-publisher config is pinned to a specific GitHub Actions environment — which this workflow was not declaring, so even a correct OIDC token would be rejected.

What changed

  1. Upgrade @semantic-release/npm 12.0.2 → 13.2.0 (package.json + package-lock.json).
    • v13.1.0 replaced the npm whoami auth probe with npm publish --dry-run output parsing, which works natively with trusted publishing. No NPM_TOKEN needed.
  2. Add environment: 'npmjs:@ui5/webcomponents-geomap' at the release job level.
    • This is the GHA environment pinned on the npmjs.com trusted-publisher config. The OIDC token's environment claim must match or npm rejects the publish.
  3. Remove registry-url from setup-node.
  4. Remove the NPM_AUTH_TOKEN: "" env entries on both the dry-run and real-release steps and refresh the comment to describe the new OIDC-native flow.

Repo-side prerequisite ⚠️

A GitHub Environment named exactly npmjs:@ui5/webcomponents-geomap must exist on this repo:

  • Repo → Settings → Environments → New environment → name npmjs:@ui5/webcomponents-geomap.
  • Recommended: under Deployment branches and tags, select Selected branches and tags and allow only main and next — matches the inputs.branch choices.
  • No secrets or reviewers required.

Without that environment the workflow run will fail to start the release job (GHA refuses the environment: reference).

Verification

After merge + environment creation, re-run the workflow with dry_run: true:

  • Verify auth (dry-run only) should pass (no EINVALIDNPMTOKEN).
  • Logs should show the OIDC token exchange succeeding against npmjs.com.

References

…nfig

- Upgrade @semantic-release/npm 12.0.2 → 13.2.0: adds native OIDC
  trusted-publishing support and replaces the npm whoami auth check
  with npm publish --dry-run output parsing. Fixes the EINVALIDNPMTOKEN
  failure in the dry-run step when no NPM_TOKEN is configured.
- Pin the job to the GitHub Actions environment
  'npmjs:@ui5/webcomponents-geomap' — npmjs.com's trusted-publisher
  config requires the OIDC claim's environment to match.
- Drop registry-url from setup-node: without a token, the .npmrc
  template referencing ${NODE_AUTH_TOKEN} is not needed and only risks
  interfering with the OIDC exchange.
- Drop NPM_AUTH_TOKEN env entries and refresh the explanatory comment
  on the Release step.

Repo-side prerequisite: a GitHub Environment named
'npmjs:@ui5/webcomponents-geomap' must exist on the repo (optionally
with deployment-branch restriction to main/next).
@adrian-bobev adrian-bobev self-assigned this Oct 16, 2026
@miloshevb
miloshevb merged commit ce79ee8 into main Oct 16, 2026
4 checks passed
@miloshevb
miloshevb deleted the ci/release-trusted-publisher-oidc branch October 16, 2026 09:49
@sap-ui5-webcomponents-release

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.0 🎉

The release is available on npm and GitHub releases.

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