Skip to content

Commit 597569d

Browse files
authored
ci: update action-npm-publish + upgrade yarn@4.16.0 (#37)
Re-aligning with our latest actions to be able to publish this package again. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches the production npm release pipeline and token/OIDC permissions; a misconfiguration could block releases or affect publish auth, but changes are limited to CI workflows. > > **Overview** > Updates the **release publish** GitHub Actions path so npm publishing can run again with current MetaMask actions. > > The reusable `publish-release` workflow bumps **checkout/setup**, **artifact upload/download**, and **`action-npm-publish` v5 → v6**, with dry runs using an explicit `dry-run: true` instead of omitting `NPM_TOKEN`. **`NPM_TOKEN` is no longer required** at the `workflow_call` secret level (still used for the real publish step in the `npm-publish` environment). > > **OIDC-style publishing** is enabled by adding **`id-token: write`** on the caller `publish-release` job in `main.yml` and on the `publish-npm` job, plus default **`contents: read`** on the reusable workflow and publish job. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 462cfdb. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 96cacfb commit 597569d

6 files changed

Lines changed: 31 additions & 907 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
name: Publish release
8787
permissions:
8888
contents: write
89+
id-token: write
8990
uses: ./.github/workflows/publish-release.yml
9091
secrets:
9192
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish-release.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ on:
44
workflow_call:
55
secrets:
66
NPM_TOKEN:
7-
required: true
7+
required: false
88
SLACK_WEBHOOK_URL:
99
required: true
1010
PUBLISH_DOCS_TOKEN:
1111
required: true
12+
13+
permissions:
14+
contents: read
15+
1216
jobs:
1317
publish-release:
1418
permissions:
1519
contents: write
1620
runs-on: ubuntu-latest
1721
steps:
1822
- name: Checkout and setup environment
19-
uses: MetaMask/action-checkout-and-setup@v1
23+
uses: MetaMask/action-checkout-and-setup@v3
2024
with:
2125
is-high-risk-environment: true
2226
ref: ${{ github.sha }}
@@ -25,7 +29,7 @@ jobs:
2529
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2630
- run: yarn build
2731
- name: Upload build artifacts
28-
uses: actions/upload-artifact@v4
32+
uses: actions/upload-artifact@v7
2933
with:
3034
name: publish-release-artifacts-${{ github.sha }}
3135
retention-days: 4
@@ -39,18 +43,19 @@ jobs:
3943
runs-on: ubuntu-latest
4044
steps:
4145
- name: Checkout and setup environment
42-
uses: MetaMask/action-checkout-and-setup@v1
46+
uses: MetaMask/action-checkout-and-setup@v3
4347
with:
4448
is-high-risk-environment: true
4549
ref: ${{ github.sha }}
4650
- name: Restore build artifacts
47-
uses: actions/download-artifact@v4
51+
uses: actions/download-artifact@v8
4852
with:
4953
name: publish-release-artifacts-${{ github.sha }}
5054
- name: Dry Run Publish
51-
# omit npm-token token to perform dry run publish
52-
uses: MetaMask/action-npm-publish@v5
55+
uses: MetaMask/action-npm-publish@v6
5356
with:
57+
dry-run: true
58+
# No need for `NPM_TOKEN` for dry-runs.
5459
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
5560
subteam: S042S7RE4AE # @metamask-npm-publishers
5661
env:
@@ -60,19 +65,23 @@ jobs:
6065
needs: publish-npm-dry-run
6166
runs-on: ubuntu-latest
6267
environment: npm-publish
68+
permissions:
69+
contents: read
70+
id-token: write
6371
steps:
6472
- name: Checkout and setup environment
65-
uses: MetaMask/action-checkout-and-setup@v1
73+
uses: MetaMask/action-checkout-and-setup@v3
6674
with:
6775
is-high-risk-environment: true
6876
ref: ${{ github.sha }}
6977
- name: Restore build artifacts
70-
uses: actions/download-artifact@v4
78+
uses: actions/download-artifact@v8
7179
with:
7280
name: publish-release-artifacts-${{ github.sha }}
7381
- name: Publish
74-
uses: MetaMask/action-npm-publish@v5
82+
uses: MetaMask/action-npm-publish@v6
7583
with:
84+
dry-run: false
7685
# This `NPM_TOKEN` needs to be manually set per-repository.
7786
# Look in the repository settings under "Environments", and set this token in the `npm-publish` environment.
7887
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)