Skip to content

Commit 6b15303

Browse files
committed
Migrate @next releases to trusted publishing
1 parent 6cd54e4 commit 6b15303

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/publish_next_compute-baseline.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
paths:
88
- packages/compute-baseline/**
99

10+
permissions: {}
11+
1012
env:
1113
package: "compute-baseline"
1214
package_dir: "packages/compute-baseline"
@@ -15,6 +17,8 @@ env:
1517
jobs:
1618
test:
1719
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
1822
steps:
1923
- uses: actions/checkout@v6
2024
- uses: actions/setup-node@v6
@@ -27,6 +31,12 @@ jobs:
2731
if: github.repository == 'web-platform-dx/web-features'
2832
runs-on: ubuntu-latest
2933
needs: "test"
34+
permissions:
35+
contents: read
36+
# Required for OIDC and trusted publishing. See:
37+
# - https://docs.npmjs.com/trusted-publishers
38+
# - https://docs.github.com/en/actions/concepts/security/openid-connect
39+
id-token: write
3040
steps:
3141
- name: Get timestamp
3242
id: timestamp
@@ -37,6 +47,7 @@ jobs:
3747
node-version-file: .node-version
3848
cache: npm
3949
registry-url: "https://registry.npmjs.org"
50+
- run: npm install -g 'npm@>=11.5.1 # required for trusted publishing
4051
- run: npm ci
4152
- name: Get package.json version
4253
id: version
@@ -49,5 +60,3 @@ jobs:
4960
VERSION: ${{ steps.version.outputs.VERSION }}
5061
TIMESTAMP: ${{ steps.timestamp.outputs.TIMESTAMP }}
5162
- run: npm publish --workspace=${{ env.package }} --tag ${{ env.dist_tag }}
52-
env:
53-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish_next_web-features.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ on:
1212
- index.ts
1313
- scripts/build.ts
1414

15-
permissions:
16-
contents: write
15+
permissions: {}
1716

1817
env:
1918
package: "web-features"
@@ -23,6 +22,8 @@ env:
2322
jobs:
2423
test:
2524
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
2627
steps:
2728
- uses: actions/checkout@v6
2829
- uses: actions/setup-node@v6
@@ -35,6 +36,12 @@ jobs:
3536
if: github.repository == 'web-platform-dx/web-features'
3637
runs-on: ubuntu-latest
3738
needs: "test"
39+
permissions:
40+
contents: write
41+
# Required for OIDC and trusted publishing. See:
42+
# - https://docs.npmjs.com/trusted-publishers
43+
# - https://docs.github.com/en/actions/concepts/security/openid-connect
44+
id-token: write
3845
steps:
3946
- uses: actions/checkout@v6
4047
- name: Get timestamp and short hash
@@ -48,6 +55,8 @@ jobs:
4855
node-version-file: .node-version
4956
cache: npm
5057
registry-url: "https://registry.npmjs.org"
58+
59+
- run: npm install -g 'npm@>=11.5.1' # required for trusted publishing
5160
- run: npm ci
5261

5362
- run: npm run build
@@ -67,11 +76,8 @@ jobs:
6776
VERSION: ${{ steps.version.outputs.VERSION }}
6877
TIMESTAMP: ${{ steps.timestamp_and_hash.outputs.TIMESTAMP }}
6978
SHORT_HASH: ${{ steps.timestamp_and_hash.outputs.SHORT_HASH }}
70-
- if: ${{ env.NODE_AUTH_TOKEN }}
71-
run: npm publish --tag ${{ env.dist_tag }}
79+
- run: npm publish --tag ${{ env.dist_tag }}
7280
working-directory: ${{ env.package_dir }}
73-
env:
74-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7581

7682
- name: Set existing release to draft
7783
run: gh release edit --draft "$TAG"

0 commit comments

Comments
 (0)