File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 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+
3447 - name : Install dependencies
3548 run : npm ci
3649
You can’t perform that action at this time.
0 commit comments