Skip to content

Commit 25d93cd

Browse files
committed
ci: smoke test OIDC in release step
1 parent c194509 commit 25d93cd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ jobs:
3131
node-version: ${{ matrix.node }}
3232
cache: 'npm'
3333

34-
- name: Smoke GitHub OIDC token exchange for npm publish
35-
shell: bash
36-
run: |
37-
set -euo pipefail
38-
REG=$(npm -s config get registry||:); REG=${REG%/}; : "${REG:=https://registry.npmjs.org}"
39-
HOST=${REG#*://}; HOST=${HOST%%/*}
40-
ID=$(curl -fsS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=npm:${HOST}" | jq -er .value)
41-
PKG=$(jq -r '.name|@uri' package.json)
42-
RESP=$(curl -fsS -H "Authorization: Bearer $ID" "$REG/-/npm/v1/oidc/token/exchange/package/$PKG" -d "")
43-
TOKEN=$(echo "$RESP" | jq -er '.token')
44-
echo "::add-mask::$TOKEN"
45-
[ -n "$TOKEN" ]
46-
4734
- name: Install dependencies
4835
run: npm ci
4936

@@ -118,17 +105,30 @@ jobs:
118105

119106
steps:
120107
- name: Checkout code
121-
uses: actions/checkout@v4
108+
uses: actions/checkout@v5
122109
with:
123110
fetch-depth: 0
124111

125112
- name: Setup Node.js 22.18.0
126-
uses: actions/setup-node@v4
113+
uses: actions/setup-node@v6
127114
with:
128115
node-version: 22.18.0
129116
cache: 'npm'
130117
registry-url: 'https://registry.npmjs.org'
131118

119+
- name: Smoke GitHub OIDC token exchange for npm publish
120+
shell: bash
121+
run: |
122+
set -euo pipefail
123+
REG=$(npm -s config get registry||:); REG=${REG%/}; : "${REG:=https://registry.npmjs.org}"
124+
HOST=${REG#*://}; HOST=${HOST%%/*}
125+
ID=$(curl -fsS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=npm:${HOST}" | jq -er .value)
126+
PKG=$(jq -r '.name|@uri' package.json)
127+
RESP=$(curl -fsS -H "Authorization: Bearer $ID" "$REG/-/npm/v1/oidc/token/exchange/package/$PKG" -d "")
128+
TOKEN=$(echo "$RESP" | jq -er '.token')
129+
echo "::add-mask::$TOKEN"
130+
[ -n "$TOKEN" ]
131+
132132
- name: Install dependencies
133133
run: npm ci
134134

0 commit comments

Comments
 (0)