From 53a48a7ffa60baf363298f3bb6e938c0324aff3e Mon Sep 17 00:00:00 2001 From: 0xEdouard <15703023+0xEdouardEth@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:10:45 +0200 Subject: [PATCH 1/2] chore: migrate npm publishing to trusted publishing --- .github/workflows/main.yml | 1 + .github/workflows/publish-release.yml | 17 +++++++++++------ package.json | 2 +- yarn.lock | 10 +++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21493f8..552e5de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,6 +86,7 @@ jobs: name: Publish release permissions: contents: write + id-token: write uses: ./.github/workflows/publish-release.yml secrets: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index b487226..e179f72 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -4,7 +4,7 @@ on: workflow_call: secrets: NPM_TOKEN: - required: true + required: false SLACK_WEBHOOK_URL: required: true PUBLISH_DOCS_TOKEN: @@ -48,8 +48,7 @@ jobs: with: name: publish-release-artifacts-${{ github.sha }} - name: Dry Run Publish - # omit npm-token token to perform dry run publish - uses: MetaMask/action-npm-publish@v5 + uses: MetaMask/action-npm-publish@v6 with: slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} subteam: S042S7RE4AE # @metamask-npm-publishers @@ -60,6 +59,9 @@ jobs: needs: publish-npm-dry-run runs-on: ubuntu-latest environment: npm-publish + permissions: + contents: read + id-token: write steps: - name: Checkout and setup environment uses: MetaMask/action-checkout-and-setup@v1 @@ -71,10 +73,13 @@ jobs: with: name: publish-release-artifacts-${{ github.sha }} - name: Publish - uses: MetaMask/action-npm-publish@v5 + uses: MetaMask/action-npm-publish@v6 with: - # This `NPM_TOKEN` needs to be manually set per-repository. - # Look in the repository settings under "Environments", and set this token in the `npm-publish` environment. + # This `NPM_TOKEN` needs to be manually set to publish a package for + # the first time only. + # Look in the repository settings under "Environments", and set this + # token in the `npm-publish` environment, and delete it after the + # initial publish. npm-token: ${{ secrets.NPM_TOKEN }} env: SKIP_PREPACK: true diff --git a/package.json b/package.json index 6aeb8b3..d4ff290 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "vite": "^6.2.5", "vitest": "^3.0.7" }, - "packageManager": "yarn@4.1.1", + "packageManager": "yarn@4.16.0", "engines": { "node": "^18.20 || ^20.17 || >=22" }, diff --git a/yarn.lock b/yarn.lock index 3d50e36..9a5f6b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # Manual changes might be lost - proceed with caution! __metadata: - version: 8 + version: 10 cacheKey: 10 "@andrewbranch/untar.js@npm:^1.0.3": @@ -5365,21 +5365,21 @@ __metadata: "typescript@patch:typescript@npm%3A5.6.1-rc#optional!builtin": version: 5.6.1-rc - resolution: "typescript@patch:typescript@npm%3A5.6.1-rc#optional!builtin::version=5.6.1-rc&hash=5adc0c" + resolution: "typescript@patch:typescript@npm%3A5.6.1-rc#optional!builtin::version=5.6.1-rc&hash=8c6c40" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/03b52131d656ea802ac2cc43209bf82e45db05d21618f149847f7693e86cb158d3140832b7d4ec32952b64a7048974e12e255f7c3ed31598a9b9d0b4ce0551d4 + checksum: 10/462e0bb46c63abfc5bfc43f2bb00b9777a4228f3ed52d8930b46404dce71dbada63c27a99262ff4570b5ff7d01455701bfd36823bd3c766e443b6fa33cd31dea languageName: node linkType: hard "typescript@patch:typescript@npm%3A~5.7.3#optional!builtin": version: 5.7.3 - resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin::version=5.7.3&hash=5adc0c" + resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin::version=5.7.3&hash=5786d5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/3ac7b7e3e899273d2fbdce6e24b93d4d53a705ad7a7e4cc83b4c57bcb6d25948abcd2a21994f6b9c73ab03960f395aae95f0458de292a66ce0134233261714c3 + checksum: 10/dc58d777eb4c01973f7fbf1fd808aad49a0efdf545528dab9b07d94fdcb65b8751742804c3057e9619a4627f2d9cc85547fdd49d9f4326992ad0181b49e61d81 languageName: node linkType: hard From 5bf8bf6b5ce9d26df5f76c46213e3b3f3f6ed30d Mon Sep 17 00:00:00 2001 From: 0xEdouard <15703023+0xEdouardEth@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:11:28 +0200 Subject: [PATCH 2/2] ci: add top-level publish workflow permissions --- .github/workflows/publish-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index e179f72..508f10b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -9,6 +9,10 @@ on: required: true PUBLISH_DOCS_TOKEN: required: true + +permissions: + contents: read + jobs: publish-release: permissions: