Skip to content

Commit 816eed4

Browse files
committed
ci(release): publish to npm through trusted publishing
The organisation's NPM_TOKEN secret no longer publishes: moxygen 2.2.0 was refused with a 404 on 18 October. npm now exchanges the release job's GitHub OIDC token for a short-lived publish credential, as sourcey's release already does, so no npm token is stored as a secret. Signed-off-by: Kam <oss@0state.com>
1 parent 35b0004 commit 816eed4

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,20 @@ jobs:
125125
- uses: actions/setup-node@v6
126126
with:
127127
node-version: 24
128-
registry-url: https://registry.npmjs.org
129128
cache: npm
130129

131130
- uses: actions/download-artifact@v8
132131
with:
133132
name: moxygen-npm-package
134133
path: .stage/release
135134

135+
# npm trusted publishing: npm exchanges this job's GitHub OIDC token for a
136+
# short-lived publish credential, so no npm token is stored as a secret.
136137
- name: Publish to npm
137138
env:
138-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
139139
VERSION: ${{ needs.validate.outputs.version }}
140140
run: |
141141
set -eu
142-
if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
143-
echo "NPM_TOKEN secret is required to publish to npm" >&2
144-
exit 1
145-
fi
146142
if npm view "moxygen@${VERSION}" version >/dev/null 2>&1; then
147143
echo "moxygen@${VERSION} already exists on npm; skipping publish"
148144
exit 0

0 commit comments

Comments
 (0)