Skip to content

Commit 00891de

Browse files
author
Onur Solmaz
committed
ci: switch npm release workflow to trusted publishing
1 parent 61a7f2e commit 00891de

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎.github/workflows/openclaw-npm-release.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
runs-on: ubuntu-latest
2727
permissions:
2828
contents: read
29-
id-token: write
3029
steps:
3130
- name: Checkout
3231
uses: actions/checkout@v6
@@ -57,7 +56,6 @@ jobs:
5756
echo "Would run: pnpm check"
5857
echo "Would run: pnpm build"
5958
echo "Would run: pnpm release:check"
60-
bash scripts/openclaw-npm-publish.sh --dry-run
6159
6260
- name: Validate release tag and package metadata
6361
env:
@@ -111,6 +109,16 @@ jobs:
111109
contents: read
112110
id-token: write
113111
steps:
112+
- name: Validate tag input format
113+
env:
114+
RELEASE_TAG: ${{ inputs.tag }}
115+
run: |
116+
set -euo pipefail
117+
if [[ ! "${RELEASE_TAG}" =~ ^v[0-9]{4}\.[1-9][0-9]*\.[1-9][0-9]*(-beta\.[1-9][0-9]*)?$ ]]; then
118+
echo "Invalid release tag format: ${RELEASE_TAG}"
119+
exit 1
120+
fi
121+
114122
- name: Checkout
115123
uses: actions/checkout@v6
116124
with:
@@ -161,6 +169,4 @@ jobs:
161169
run: pnpm release:check
162170

163171
- name: Publish
164-
env:
165-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
166172
run: bash scripts/openclaw-npm-publish.sh --publish

‎docs/reference/RELEASING.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Historical note:
9494

9595
- [ ] Confirm git status is clean; commit and push as needed.
9696
- [ ] Confirm npm trusted publishing is configured for the `openclaw` package.
97+
- [ ] Do not rely on an `NPM_TOKEN` secret for this workflow; the publish job uses GitHub OIDC trusted publishing.
9798
- [ ] Push the matching git tag to trigger the preview run in `.github/workflows/openclaw-npm-release.yml`.
9899
- [ ] Run `OpenClaw NPM Release` manually with the same tag to publish after `npm-release` environment approval.
99100
- Stable tags publish to npm `latest`.

‎scripts/openclaw-npm-publish.sh‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@ fi
2020

2121
echo "Resolved package version: ${package_version}"
2222
echo "Resolved release channel: ${release_channel}"
23-
24-
if [[ -n "${NODE_AUTH_TOKEN:-}" ]]; then
25-
if [[ "${mode}" == "--dry-run" ]]; then
26-
echo 'Would write npm auth config to $HOME/.npmrc using NODE_AUTH_TOKEN'
27-
else
28-
printf '//registry.npmjs.org/:_authToken=%s\n' "${NODE_AUTH_TOKEN}" > "${HOME}/.npmrc"
29-
fi
30-
else
31-
echo 'No NODE_AUTH_TOKEN set in this environment'
32-
fi
23+
echo "Publish auth: GitHub OIDC trusted publishing"
3324

3425
printf 'Publish command:'
3526
printf ' %q' "${publish_cmd[@]}"

0 commit comments

Comments
 (0)