Skip to content

Commit 846a810

Browse files
committed
fix: troubleshoot npm publish error after changing to trusted publishers
1 parent 3d2a1e1 commit 846a810

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/manual-publish.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup Node.js
3737
uses: actions/setup-node@v4
3838
with:
39-
node-version: '22'
39+
node-version: '20'
4040
registry-url: 'https://registry.npmjs.org'
4141

4242
- name: Install dependencies
@@ -45,11 +45,29 @@ jobs:
4545
- name: Build TypeScript package
4646
run: npm run build
4747

48+
- name: Preflight OIDC and npm registry
49+
working-directory: packages/flarelette-jwt-ts
50+
run: |
51+
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" ]; then
52+
echo "OIDC token request URL is missing (check id-token: write permissions)."
53+
exit 1
54+
fi
55+
echo "OIDC environment is available."
56+
npm config get registry
57+
58+
- name: OIDC token check
59+
run: |
60+
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-}" ]; then
61+
echo "OIDC request token is missing (check id-token: write permissions)."
62+
exit 1
63+
fi
64+
curl -fsS -H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
65+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=npm:registry.npmjs.org" > /tmp/oidc.json
66+
echo "OIDC token fetch OK"
67+
4868
- name: Publish to npm
4969
id: npm_publish
5070
working-directory: packages/flarelette-jwt-ts
51-
env:
52-
NODE_AUTH_TOKEN: ''
5371
run: npm publish --provenance --access public
5472

5573
- name: Upload npm debug logs (on failure)

0 commit comments

Comments
 (0)