Skip to content

Commit c651ce1

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

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.github/workflows/publish_next_compute-baseline.yml

Lines changed: 8 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"
@@ -27,6 +29,11 @@ jobs:
2729
if: github.repository == 'web-platform-dx/web-features'
2830
runs-on: ubuntu-latest
2931
needs: "test"
32+
permissions:
33+
# Required for OIDC and trusted publishing. See:
34+
# - https://docs.npmjs.com/trusted-publishers
35+
# - https://docs.github.com/en/actions/concepts/security/openid-connect
36+
id-token: write
3037
steps:
3138
- name: Get timestamp
3239
id: timestamp
@@ -37,6 +44,7 @@ jobs:
3744
node-version-file: .node-version
3845
cache: npm
3946
registry-url: "https://registry.npmjs.org"
47+
- run: npm install -g 'npm@>=11.5.1 # required for trusted publishing
4048
- run: npm ci
4149
- name: Get package.json version
4250
id: version
@@ -49,5 +57,3 @@ jobs:
4957
VERSION: ${{ steps.version.outputs.VERSION }}
5058
TIMESTAMP: ${{ steps.timestamp.outputs.TIMESTAMP }}
5159
- 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: 10 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"
@@ -35,6 +34,12 @@ jobs:
3534
if: github.repository == 'web-platform-dx/web-features'
3635
runs-on: ubuntu-latest
3736
needs: "test"
37+
permissions:
38+
contents: write
39+
# Required for OIDC and trusted publishing. See:
40+
# - https://docs.npmjs.com/trusted-publishers
41+
# - https://docs.github.com/en/actions/concepts/security/openid-connect
42+
id-token: write
3843
steps:
3944
- uses: actions/checkout@v6
4045
- name: Get timestamp and short hash
@@ -48,6 +53,8 @@ jobs:
4853
node-version-file: .node-version
4954
cache: npm
5055
registry-url: "https://registry.npmjs.org"
56+
57+
- run: npm install -g 'npm@>=11.5.1' # required for trusted publishing
5158
- run: npm ci
5259

5360
- run: npm run build
@@ -67,11 +74,8 @@ jobs:
6774
VERSION: ${{ steps.version.outputs.VERSION }}
6875
TIMESTAMP: ${{ steps.timestamp_and_hash.outputs.TIMESTAMP }}
6976
SHORT_HASH: ${{ steps.timestamp_and_hash.outputs.SHORT_HASH }}
70-
- if: ${{ env.NODE_AUTH_TOKEN }}
71-
run: npm publish --tag ${{ env.dist_tag }}
77+
- run: npm publish --tag ${{ env.dist_tag }}
7278
working-directory: ${{ env.package_dir }}
73-
env:
74-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7579

7680
- name: Set existing release to draft
7781
run: gh release edit --draft "$TAG"

0 commit comments

Comments
 (0)