Skip to content

Commit 57c3e2b

Browse files
authored
ci: Upgrade Yarn to 4.16.0 and update action-npm-publish to v6 (#203)
* Upgrade Yarn to 4.16.0 and update action-npm-publish to v6 * Fix lint error
1 parent f1b84b9 commit 57c3e2b

6 files changed

Lines changed: 1828 additions & 2602 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: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ on:
44
workflow_call:
55
secrets:
66
NPM_TOKEN:
7-
required: true
7+
required: false
88
SLACK_WEBHOOK_URL:
99
required: true
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
publish-release:
1316
permissions:
@@ -47,8 +50,7 @@ jobs:
4750
with:
4851
name: publish-release-artifacts-${{ github.sha }}
4952
- name: Dry Run Publish
50-
# omit npm-token token to perform dry run publish
51-
uses: MetaMask/action-npm-publish@v5
53+
uses: MetaMask/action-npm-publish@v6
5254
with:
5355
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
5456
subteam: S042S7RE4AE # @metamask-npm-publishers
@@ -59,6 +61,9 @@ jobs:
5961
needs: publish-npm-dry-run
6062
runs-on: ubuntu-latest
6163
environment: npm-publish
64+
permissions:
65+
contents: read
66+
id-token: write
6267
steps:
6368
- name: Checkout and setup environment
6469
uses: MetaMask/action-checkout-and-setup@v1
@@ -70,10 +75,13 @@ jobs:
7075
with:
7176
name: publish-release-artifacts-${{ github.sha }}
7277
- name: Publish
73-
uses: MetaMask/action-npm-publish@v5
78+
uses: MetaMask/action-npm-publish@v6
7479
with:
75-
# This `NPM_TOKEN` needs to be manually set per-repository.
76-
# Look in the repository settings under "Environments", and set this token in the `npm-publish` environment.
80+
# This `NPM_TOKEN` needs to be manually set to publish a package for
81+
# the first time only.
82+
# Look in the repository settings under "Environments", and set this
83+
# token in the `npm-publish` environment, and delete it after the
84+
# initial publish.
7785
npm-token: ${{ secrets.NPM_TOKEN }}
7886
env:
7987
SKIP_PREPACK: true

.yarn/releases/yarn-3.2.4.cjs

Lines changed: 0 additions & 801 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1+
# Allowlist for Git repositories that can be used as dependencies. We set it to
2+
# an empty array to disallow all Git dependencies, as we don't use any and they
3+
# can be a security risk.
4+
approvedGitRepositories: []
5+
6+
compressionLevel: mixed
7+
8+
enableGlobalCache: false
9+
110
enableScripts: false
211

3-
enableTelemetry: 0
12+
enableTelemetry: false
413

514
logFilters:
615
- code: YN0004
716
level: discard
817

918
nodeLinker: node-modules
1019

20+
# Configure the NPM minimal age gate to 3 days, meaning packages must be at
21+
# least 3 days old to be installed.
22+
npmMinimalAgeGate: 4320 # 3 days (in minutes)
23+
24+
# Override the minimal age gate, allowing certain packages to be installed
25+
# regardless of their publish age.
26+
npmPreapprovedPackages:
27+
- '@metamask/*'
28+
- '@metamask-previews/*'
29+
- '@lavamoat/*'
30+
1131
plugins:
1232
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
1333
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'
14-
15-
yarnPath: .yarn/releases/yarn-3.2.4.cjs

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"ts-jest": "^28.0.7",
6363
"typescript": "~4.8.4"
6464
},
65-
"packageManager": "yarn@3.8.5",
65+
"packageManager": "yarn@4.16.0",
6666
"engines": {
6767
"node": "^18.16 || >=20"
6868
},

0 commit comments

Comments
 (0)