Skip to content

Commit ad49a57

Browse files
authored
chore(ci): fix releaser (#1619)
1 parent 39c5578 commit ad49a57

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

scripts/release-canary.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { execSync } from 'child_process'
2323
// can be restored afterwards and used by releasePublish. We can't use the same
2424
// token, because releasePublish wants a token that has the id_token: write permission
2525
// so that we can use OIDC for trusted publishing
26-
26+
const gh_token_bak = process.env.GITHUB_TOKEN
27+
process.env.GITHUB_TOKEN = process.env.RELEASE_GITHUB_TOKEN
2728
// backup original auth header
2829
const originalAuth = execSync('git config --local http.https://github.com/.extraheader')
2930
.toString()
@@ -42,6 +43,9 @@ import { execSync } from 'child_process'
4243
// npm publish with OIDC
4344
// not strictly necessary to restore the header but do it incase we require it later
4445
execSync(`git config --local http.https://github.com/.extraheader "${originalAuth}"`)
46+
// restore the GH token
47+
process.env.GITHUB_TOKEN = gh_token_bak
48+
4549
const publishResult = await releasePublish({
4650
registry: 'https://registry.npmjs.org/',
4751
access: 'public',

scripts/release-stable.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ if (!validSpecifiers.includes(versionSpecifier) && !isValidVersion) {
6161
// can be restored afterwards and used by releasePublish. We can't use the same
6262
// token, because releasePublish wants a token that has the id_token: write permission
6363
// so that we can use OIDC for trusted publishing
64-
64+
const gh_token_bak = process.env.GITHUB_TOKEN
65+
process.env.GITHUB_TOKEN = process.env.RELEASE_GITHUB_TOKEN
6566
// backup original auth header
6667
const originalAuth = execSync('git config --local http.https://github.com/.extraheader')
6768
.toString()
@@ -81,6 +82,8 @@ if (!validSpecifiers.includes(versionSpecifier) && !isValidVersion) {
8182
// npm publish with OIDC
8283
// not strictly necessary to restore the header but do it incase we require it later
8384
execSync(`git config --local http.https://github.com/.extraheader "${originalAuth}"`)
85+
// restore the GH token
86+
process.env.GITHUB_TOKEN = gh_token_bak
8487

8588
const publishResult = await releasePublish({
8689
registry: 'https://registry.npmjs.org/',

0 commit comments

Comments
 (0)