@@ -47,22 +47,30 @@ jobs:
4747 config-file : .github/release-please/release-please-config.json
4848 manifest-file : .github/release-please/.release-please-manifest.json
4949
50+ # Publish when release-please cuts a new release, or when the workflow is
51+ # run manually to retry a release whose npm publish failed. publish-packages
52+ # skips any version already on the registry, so a manual run is a safe no-op
53+ # when everything is already published.
54+ - id : should_publish
55+ run : echo "result=${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}" >> "$GITHUB_OUTPUT"
56+
5057 - uses : actions/checkout@v4
51- # these if statements ensure that a publication only occurs when
52- # a new release is created:
53- if : ${{ steps.release.outputs.releases_created == 'true' }}
58+ if : ${{ steps.should_publish.outputs.result == 'true' }}
5459
60+ # No registry-url here on purpose: it makes setup-node write an .npmrc with
61+ # `_authToken=${NODE_AUTH_TOKEN}` plus a placeholder token, which npm falls
62+ # back to and fails with a misleading E404 when OIDC is not accepted.
63+ # Publishing authenticates via trusted publishing (OIDC) instead.
5564 - uses : actions/setup-node@v4
5665 with :
5766 node-version : 24
58- registry-url : ' https://registry.npmjs.org'
59- if : ${{ steps.release.outputs.releases_created == 'true' }}
67+ if : ${{ steps.should_publish.outputs.result == 'true' }}
6068
6169 - run : npm ci
62- if : ${{ steps.release .outputs.releases_created == 'true' }}
70+ if : ${{ steps.should_publish .outputs.result == 'true' }}
6371
6472 - run : npm run build
65- if : ${{ steps.release .outputs.releases_created == 'true' }}
73+ if : ${{ steps.should_publish .outputs.result == 'true' }}
6674
6775 - run : npm exec -c publish-packages
68- if : ${{ steps.release .outputs.releases_created == 'true' }}
76+ if : ${{ steps.should_publish .outputs.result == 'true' }}
0 commit comments