File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 16
16
NODE_VERSION : ' 20'
17
17
18
18
jobs :
19
- release-stable :
19
+ release-stable : # stable releases can only be manually triggered
20
20
if : ${{ github.event_name == 'workflow_dispatch' }}
21
21
runs-on : ubuntu-latest
22
22
permissions :
74
74
cache : ' npm'
75
75
registry-url : ' https://registry.npmjs.org'
76
76
77
+ # Ensure npm 11.5.1 or later is installed for trusted publishing support
77
78
- name : Update npm
78
79
run : npm install -g npm@latest
79
80
@@ -206,7 +207,12 @@ jobs:
206
207
uses : ./.github/workflows/ci-auth-js-node18.yml
207
208
permissions :
208
209
actions : read
209
- contents : read
210
+ contents :
211
+ read
212
+
213
+ # ==========================================
214
+ # CANARY RELEASE (only on master, after all CI passes)
215
+ # ==========================================
210
216
211
217
release-canary :
212
218
name : Release Canary
@@ -215,6 +221,7 @@ jobs:
215
221
permissions :
216
222
contents : read
217
223
id-token : write
224
+ # Only run on master branch pushes, and only if all CI jobs succeeded
218
225
if : |
219
226
github.ref == 'refs/heads/master' &&
220
227
github.event_name == 'push' &&
@@ -241,6 +248,7 @@ jobs:
241
248
cache : ' npm'
242
249
registry-url : ' https://registry.npmjs.org'
243
250
251
+ # Ensure npm 11.5.1 or later is installed for trusted publishing support
244
252
- name : Update npm
245
253
run : npm install -g npm@latest
246
254
- name : Install dependencies
Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ function safeExec(cmd: string, opts = {}) {
69
69
70
70
// --- GIT AUTH SETUP FOR TAGGING/CHANGELOG ---
71
71
72
+ // releaseChangelog should use the GitHub token with permission for tagging
73
+ // before switching the token, backup the GITHUB_TOKEN so that it
74
+ // can be restored afterwards and used by releasePublish. We can't use the same
75
+ // token, because releasePublish wants a token that has the id_token: write permission
76
+ // so that we can use OIDC for trusted publishing
77
+
72
78
const gh_token_bak = process . env . GITHUB_TOKEN
73
79
process . env . GITHUB_TOKEN = process . env . RELEASE_GITHUB_TOKEN
74
80
@@ -94,7 +100,8 @@ function safeExec(cmd: string, opts = {}) {
94
100
} )
95
101
96
102
// --- RESTORE GIT AUTH FOR PUBLISHING ---
97
-
103
+ // npm publish with OIDC
104
+ // not strictly necessary to restore the header but do it incase we require it later
98
105
if ( originalAuth ) {
99
106
safeExec ( `git config --local http.https://github.com/.extraheader "${ originalAuth } "` )
100
107
} else {
You can’t perform that action at this time.
0 commit comments