Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 6 additions & 28 deletions .github/workflows/publish-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
with:
ref: ${{ inputs.tag }} # rebuild from the exact tagged commit

# registry-url IS required for OIDC trusted publishing (npm needs to know
# which registry to run the OIDC exchange against).
# registry-url IS required for OIDC (npm needs a registry to run the
# exchange against).
- uses: actions/setup-node@v4
with:
node-version: 22
Expand All @@ -41,26 +41,10 @@ jobs:
# the OIDC exchange -> ENEEDAUTH/404. Strip that line so OIDC runs.
# See actions/setup-node#1551.
- name: Enable OIDC (drop empty _authToken from .npmrc)
run: |
npmrc="${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}"
sed -i '/_authToken/d' "$npmrc" || true
echo "cleaned: $npmrc"

- name: Upgrade npm and show version (trusted publishing needs >= 11.5.1)
run: |
npm install -g npm@latest
npm --version
run: sed -i '/_authToken/d' "${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}" || true

- name: Diagnose OIDC prerequisites
run: |
echo "node: $(node --version) (need >= 22.14.0)"
echo "npm: $(npm --version) (need >= 11.5.1)"
echo "ACTIONS_ID_TOKEN_REQUEST_URL: ${ACTIONS_ID_TOKEN_REQUEST_URL:+SET}${ACTIONS_ID_TOKEN_REQUEST_URL:-UNSET}"
echo "ACTIONS_ID_TOKEN_REQUEST_TOKEN: ${ACTIONS_ID_TOKEN_REQUEST_TOKEN:+SET}${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-UNSET}"
echo "npm registry: $(npm config get registry)"
echo "--- .npmrc (${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}) ---"
sed 's/\(_authToken=\).*/\1<redacted>/' "${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}" 2>/dev/null || echo "(no .npmrc)"
echo "--- end ---"
- name: Upgrade npm (trusted publishing needs >= 11.5.1)
run: npm install -g npm@latest

- run: npm ci
- run: npm run build
Expand All @@ -81,13 +65,7 @@ jobs:
npm version "${VERSION}" --no-git-tag-version --allow-same-version

- name: Publish to public npm with provenance
run: npm publish --provenance --access public --loglevel verbose

- name: Dump npm debug log on failure
if: failure()
run: |
echo "=== npm debug log (tail) ==="
tail -n 80 /home/runner/.npm/_logs/*-debug-0.log 2>/dev/null || echo "(no debug log)"
run: npm publish --provenance --access public

- name: Promote the GitHub Release to full/latest
env:
Expand Down
Loading