Skip to content

chore: migrate NPM publishing to trusted publishing (OIDC) via action-npm-publish@v6#321

Open
wenfix wants to merge 1 commit into
mainfrom
wapi-1542
Open

chore: migrate NPM publishing to trusted publishing (OIDC) via action-npm-publish@v6#321
wenfix wants to merge 1 commit into
mainfrom
wapi-1542

Conversation

@wenfix

@wenfix wenfix commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Explanation

Core Platform is hardening MetaMask's NPM supply chain by replacing long-lived NPM tokens with trusted publishing (OIDC) plus staged publishing. All package owners must move to MetaMask/action-npm-publish@v6, which implements those changes. This covers all six non-private @metamask/connect packages published from this monorepo (connect, connect-evm, connect-solana, connect-multichain, multichain-ui, analytics).

Previously the release workflow published with action-npm-publish@v5 using a required, long-lived NPM_TOKEN and no id-token: write permission. This PR migrates the release publishing path to OIDC trusted publishing:

  • Bumped both the dry-run and publish steps in publish-release.yml from action-npm-publish@v5 to @v6.
  • Granted the publish-npm job permissions: id-token: write (with contents: read) so it can request the OIDC token used by trusted publishing.
  • Made the NPM_TOKEN secret optional (required: false) rather than required. The token is still passed to the publish step as the fallback / first-publish path, per the MetaMask module template.
  • Bumped packageManager to yarn@4.16.0 (latest stable; the previous 4.9.2 was below the >= 4.16.0 requirement). This also bumps the yarn.lock metadata format from version: 8 to 10.

Scope notes

  • action-checkout-and-setup / download-artifact were intentionally left untouched. Only the npm-publish action bump is required by the acceptance criteria; bumping the other helper actions is unrelated scope and is better handled separately.
  • publish-preview.yml is out of scope. It publishes preview builds to GitHub Packages via a dedicated PUBLISH_PREVIEW_NPM_TOKEN, and NPM trusted publishing (OIDC) is an npmjs.com registry feature that does not apply to GitHub Packages.
  • No SKIP_PREPACK was added (present in the module template) because none of the packages define a prepack script, so it would be a no-op here.

Verification

  • yarn install --immutable passes cleanly on Yarn 4.16.0.
  • yarn build passes (11/11 tasks).

Important

Trusted publishing must be enabled on the npm side for all six packages by the @metamask-npm-publishers team before the first OIDC-based release. Until then, publishing continues to rely on the (now optional) NPM_TOKEN.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary — N/A: CI/workflow + tooling change only, no published package code changes.
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@wenfix wenfix requested a review from a team as a code owner June 9, 2026 08:58
@@ -1,2 +1,2 @@
name: Publish Release

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.

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.

main.yml also needs to be updated to have id-token: write permission when calling this workflow.

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