Skip to content

Commit 27b1412

Browse files
authored
Release: move npm dist-tag ops private (#66660)
1 parent 41d649c commit 27b1412

2 files changed

Lines changed: 19 additions & 241 deletions

File tree

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

Lines changed: 7 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,9 @@ on:
2424
options:
2525
- beta
2626
- latest
27-
promote_beta_to_latest:
28-
description: Skip publish and promote the stable version already on npm beta to latest
29-
required: true
30-
default: false
31-
type: boolean
32-
sync_stable_dist_tags:
33-
description: Skip publish and point both latest and beta at an already-published stable version
34-
required: true
35-
default: false
36-
type: boolean
3727

3828
concurrency:
39-
group: openclaw-npm-release-${{ github.event_name == 'workflow_dispatch' && format('{0}-{1}-{2}-{3}', inputs.tag, inputs.npm_dist_tag, inputs.promote_beta_to_latest, inputs.sync_stable_dist_tags) || github.ref }}
29+
group: openclaw-npm-release-${{ github.event_name == 'workflow_dispatch' && format('{0}-{1}', inputs.tag, inputs.npm_dist_tag) || github.ref }}
4030
cancel-in-progress: false
4131

4232
env:
@@ -48,8 +38,11 @@ jobs:
4838
# PLEASE DON'T ADD LONG-RUNNING OR FLAKY CHECKS TO THE npm RELEASE PATH.
4939
# KEEP THIS WORKFLOW SHORT AND DETERMINISTIC OR IT CAN GET STUCK AND JEOPARDIZE THE RELEASE.
5040
# RELEASE-TIME LIVE OR END-TO-END VALIDATION BELONGS IN openclaw-release-checks.yml.
41+
# SECURITY NOTE: TOKEN-BASED npm dist-tag mutation moved to
42+
# openclaw/releases-private/.github/workflows/openclaw-npm-dist-tags.yml
43+
# so this public workflow can stay focused on OIDC publish only.
5144
preflight_openclaw_npm:
52-
if: ${{ inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }}
45+
if: ${{ inputs.preflight_only }}
5346
runs-on: blacksmith-32vcpu-ubuntu-2404
5447
permissions:
5548
contents: read
@@ -246,7 +239,7 @@ jobs:
246239
if-no-files-found: error
247240

248241
validate_publish_request:
249-
if: ${{ !inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }}
242+
if: ${{ !inputs.preflight_only }}
250243
runs-on: blacksmith-32vcpu-ubuntu-2404
251244
permissions:
252245
contents: read
@@ -275,7 +268,7 @@ jobs:
275268
# KEEP THE REAL RELEASE/PUBLISH PATH ON A GITHUB-HOSTED RUNNER.
276269
# npm trusted publishing + provenance requires this to stay on ubuntu-latest.
277270
needs: [validate_publish_request]
278-
if: ${{ !inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }}
271+
if: ${{ !inputs.preflight_only }}
279272
runs-on: ubuntu-latest
280273
environment: npm-release
281274
permissions:
@@ -411,205 +404,3 @@ jobs:
411404
publish_target="./${publish_target}"
412405
fi
413406
bash scripts/openclaw-npm-publish.sh --publish "${publish_target}"
414-
415-
promote_beta_to_latest:
416-
# KEEP THE MUTATING RELEASE PATH ON A GITHUB-HOSTED RUNNER TOO.
417-
# This job changes the public npm dist-tags, so we keep it aligned with the
418-
# real release path instead of moving it onto the larger Blacksmith runners.
419-
if: ${{ inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }}
420-
runs-on: ubuntu-latest
421-
environment: npm-release
422-
permissions:
423-
contents: read
424-
steps:
425-
- name: Require main workflow ref for promotion
426-
env:
427-
WORKFLOW_REF: ${{ github.ref }}
428-
run: |
429-
set -euo pipefail
430-
if [[ "${WORKFLOW_REF}" != "refs/heads/main" ]]; then
431-
echo "Promotion runs must be dispatched from main."
432-
exit 1
433-
fi
434-
435-
- name: Validate promotion inputs
436-
env:
437-
PREFLIGHT_ONLY: ${{ inputs.preflight_only }}
438-
PREFLIGHT_RUN_ID: ${{ inputs.preflight_run_id }}
439-
RELEASE_NPM_DIST_TAG: ${{ inputs.npm_dist_tag }}
440-
run: |
441-
set -euo pipefail
442-
if [[ "${PREFLIGHT_ONLY}" == "true" ]]; then
443-
echo "Promotion mode cannot run with preflight_only=true."
444-
exit 1
445-
fi
446-
if [[ -n "${PREFLIGHT_RUN_ID}" ]]; then
447-
echo "Promotion mode does not use preflight_run_id."
448-
exit 1
449-
fi
450-
if [[ "${RELEASE_NPM_DIST_TAG}" != "beta" ]]; then
451-
echo "Promotion mode expects npm_dist_tag=beta because it moves beta to latest without publishing."
452-
exit 1
453-
fi
454-
455-
- name: Validate stable tag input format
456-
env:
457-
RELEASE_TAG: ${{ inputs.tag }}
458-
run: |
459-
set -euo pipefail
460-
if [[ ! "${RELEASE_TAG}" =~ ^v[0-9]{4}\.[1-9][0-9]*\.[1-9][0-9]*(-[1-9][0-9]*)?$ ]]; then
461-
echo "Invalid stable release tag format: ${RELEASE_TAG}" >&2
462-
exit 1
463-
fi
464-
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> "$GITHUB_ENV"
465-
466-
- name: Checkout
467-
uses: actions/checkout@v6
468-
469-
- name: Setup Node environment
470-
uses: ./.github/actions/setup-node-env
471-
with:
472-
node-version: ${{ env.NODE_VERSION }}
473-
pnpm-version: ${{ env.PNPM_VERSION }}
474-
install-bun: "false"
475-
use-sticky-disk: "false"
476-
install-deps: "false"
477-
478-
- name: Validate npm dist-tags
479-
env:
480-
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
481-
run: |
482-
set -euo pipefail
483-
beta_version="$(npm view openclaw dist-tags.beta)"
484-
latest_version="$(npm view openclaw dist-tags.latest)"
485-
486-
echo "Current beta dist-tag: ${beta_version}"
487-
echo "Current latest dist-tag: ${latest_version}"
488-
489-
if [[ "${beta_version}" != "${RELEASE_VERSION}" ]]; then
490-
echo "npm beta points at ${beta_version}, expected ${RELEASE_VERSION}." >&2
491-
exit 1
492-
fi
493-
494-
if ! npm view "openclaw@${RELEASE_VERSION}" version >/dev/null 2>&1; then
495-
echo "openclaw@${RELEASE_VERSION} is not published on npm." >&2
496-
exit 1
497-
fi
498-
499-
- name: Promote beta to latest
500-
env:
501-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
502-
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
503-
run: |
504-
set -euo pipefail
505-
npm_userconfig="$(mktemp)"
506-
trap 'rm -f "${npm_userconfig}"' EXIT
507-
chmod 0600 "${npm_userconfig}"
508-
printf '//registry.npmjs.org/:_authToken=%s\n' "${NODE_AUTH_TOKEN}" > "${npm_userconfig}"
509-
NPM_CONFIG_USERCONFIG="${npm_userconfig}" npm dist-tag add "openclaw@${RELEASE_VERSION}" latest
510-
promoted_latest="$(npm view openclaw dist-tags.latest)"
511-
if [[ "${promoted_latest}" != "${RELEASE_VERSION}" ]]; then
512-
echo "npm latest points at ${promoted_latest}, expected ${RELEASE_VERSION} after promotion." >&2
513-
exit 1
514-
fi
515-
echo "Promoted openclaw@${RELEASE_VERSION} from beta to latest."
516-
517-
sync_stable_dist_tags:
518-
# This mode is for direct stable publishes where latest is correct but beta
519-
# should also point at the same stable build after release.
520-
if: ${{ inputs.sync_stable_dist_tags && !inputs.promote_beta_to_latest }}
521-
runs-on: ubuntu-latest
522-
environment: npm-release
523-
permissions:
524-
contents: read
525-
steps:
526-
- name: Require main workflow ref for dist-tag sync
527-
env:
528-
WORKFLOW_REF: ${{ github.ref }}
529-
run: |
530-
set -euo pipefail
531-
if [[ "${WORKFLOW_REF}" != "refs/heads/main" ]]; then
532-
echo "Dist-tag sync runs must be dispatched from main."
533-
exit 1
534-
fi
535-
536-
- name: Validate sync inputs
537-
env:
538-
PREFLIGHT_ONLY: ${{ inputs.preflight_only }}
539-
PREFLIGHT_RUN_ID: ${{ inputs.preflight_run_id }}
540-
RELEASE_NPM_DIST_TAG: ${{ inputs.npm_dist_tag }}
541-
run: |
542-
set -euo pipefail
543-
if [[ "${PREFLIGHT_ONLY}" == "true" ]]; then
544-
echo "Dist-tag sync mode cannot run with preflight_only=true."
545-
exit 1
546-
fi
547-
if [[ -n "${PREFLIGHT_RUN_ID}" ]]; then
548-
echo "Dist-tag sync mode does not use preflight_run_id."
549-
exit 1
550-
fi
551-
if [[ "${RELEASE_NPM_DIST_TAG}" != "latest" ]]; then
552-
echo "Dist-tag sync mode expects npm_dist_tag=latest because it points latest and beta at the stable version."
553-
exit 1
554-
fi
555-
556-
- name: Validate stable tag input format
557-
env:
558-
RELEASE_TAG: ${{ inputs.tag }}
559-
run: |
560-
set -euo pipefail
561-
if [[ ! "${RELEASE_TAG}" =~ ^v[0-9]{4}\.[1-9][0-9]*\.[1-9][0-9]*(-[1-9][0-9]*)?$ ]]; then
562-
echo "Invalid stable release tag format: ${RELEASE_TAG}" >&2
563-
exit 1
564-
fi
565-
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> "$GITHUB_ENV"
566-
567-
- name: Checkout
568-
uses: actions/checkout@v6
569-
570-
- name: Setup Node environment
571-
uses: ./.github/actions/setup-node-env
572-
with:
573-
node-version: ${{ env.NODE_VERSION }}
574-
pnpm-version: ${{ env.PNPM_VERSION }}
575-
install-bun: "false"
576-
use-sticky-disk: "false"
577-
install-deps: "false"
578-
579-
- name: Validate published stable version
580-
env:
581-
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
582-
run: |
583-
set -euo pipefail
584-
if ! npm view "openclaw@${RELEASE_VERSION}" version >/dev/null 2>&1; then
585-
echo "openclaw@${RELEASE_VERSION} is not published on npm." >&2
586-
exit 1
587-
fi
588-
589-
echo "Current latest dist-tag: $(npm view openclaw dist-tags.latest)"
590-
echo "Current beta dist-tag: $(npm view openclaw dist-tags.beta)"
591-
592-
- name: Sync stable dist-tags
593-
env:
594-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
595-
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
596-
run: |
597-
set -euo pipefail
598-
npm_userconfig="$(mktemp)"
599-
trap 'rm -f "${npm_userconfig}"' EXIT
600-
chmod 0600 "${npm_userconfig}"
601-
printf '//registry.npmjs.org/:_authToken=%s\n' "${NODE_AUTH_TOKEN}" > "${npm_userconfig}"
602-
NPM_CONFIG_USERCONFIG="${npm_userconfig}" npm dist-tag add "openclaw@${RELEASE_VERSION}" latest
603-
NPM_CONFIG_USERCONFIG="${npm_userconfig}" npm dist-tag add "openclaw@${RELEASE_VERSION}" beta
604-
605-
synced_latest="$(npm view openclaw dist-tags.latest)"
606-
synced_beta="$(npm view openclaw dist-tags.beta)"
607-
if [[ "${synced_latest}" != "${RELEASE_VERSION}" ]]; then
608-
echo "npm latest points at ${synced_latest}, expected ${RELEASE_VERSION} after sync." >&2
609-
exit 1
610-
fi
611-
if [[ "${synced_beta}" != "${RELEASE_VERSION}" ]]; then
612-
echo "npm beta points at ${synced_beta}, expected ${RELEASE_VERSION} after sync." >&2
613-
exit 1
614-
fi
615-
echo "Synced openclaw@${RELEASE_VERSION} to npm latest and beta."

‎docs/reference/RELEASING.md‎

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ OpenClaw has three public release lanes:
7474
- real npm publish must pass a successful npm `preflight_run_id`
7575
- stable npm releases default to `beta`
7676
- stable npm publish can target `latest` explicitly via workflow input
77-
- stable npm promotion from `beta` to `latest` is still available as an explicit manual mode on the trusted `OpenClaw NPM Release` workflow
78-
- direct stable publishes can also run an explicit dist-tag sync mode that
79-
points both `latest` and `beta` at the already-published stable version
80-
- those dist-tag modes still need a valid `NPM_TOKEN` in the `npm-release` environment because npm `dist-tag` management is separate from trusted publishing
77+
- token-based npm dist-tag mutation now lives in
78+
`openclaw/releases-private/.github/workflows/openclaw-npm-dist-tags.yml`
79+
for security, because `npm dist-tag add` still needs `NPM_TOKEN` while the
80+
public repo keeps OIDC-only publish
8181
- public `macOS Release` is validation-only
8282
- real private mac publish must pass successful private mac
8383
`preflight_run_id` and `validate_run_id`
@@ -116,10 +116,6 @@ OpenClaw has three public release lanes:
116116
- `preflight_run_id`: required on the real publish path so the workflow reuses
117117
the prepared tarball from the successful preflight run
118118
- `npm_dist_tag`: npm target tag for the publish path; defaults to `beta`
119-
- `promote_beta_to_latest`: `true` to skip publish and move an already-published
120-
stable `beta` build onto `latest`
121-
- `sync_stable_dist_tags`: `true` to skip publish and point both `latest` and
122-
`beta` at an already-published stable version
123119

124120
`OpenClaw Release Checks` accepts these operator-controlled inputs:
125121

@@ -134,14 +130,6 @@ Rules:
134130
- Release checks commit-SHA mode also requires the current `origin/main` HEAD
135131
- The real publish path must use the same `npm_dist_tag` used during preflight;
136132
the workflow verifies that metadata before publish continues
137-
- Promotion mode must use a stable or correction tag, `preflight_only=false`,
138-
an empty `preflight_run_id`, and `npm_dist_tag=beta`
139-
- Dist-tag sync mode must use a stable or correction tag,
140-
`preflight_only=false`, an empty `preflight_run_id`, `npm_dist_tag=latest`,
141-
and `promote_beta_to_latest=false`
142-
- Promotion and dist-tag sync modes also require a valid `NPM_TOKEN` because
143-
`npm dist-tag add` still needs regular npm auth; trusted publishing covers
144-
the package publish path only
145133

146134
## Stable npm release sequence
147135

@@ -159,17 +147,16 @@ When cutting a stable npm release:
159147
4. Save the successful `preflight_run_id`
160148
5. Run `OpenClaw NPM Release` again with `preflight_only=false`, the same
161149
`tag`, the same `npm_dist_tag`, and the saved `preflight_run_id`
162-
6. If the release landed on `beta`, run `OpenClaw NPM Release` later with the
163-
same stable `tag`, `promote_beta_to_latest=true`, `preflight_only=false`,
164-
`preflight_run_id` empty, and `npm_dist_tag=beta` when you want to move that
165-
published build to `latest`
150+
6. If the release landed on `beta`, use the private
151+
`openclaw/releases-private/.github/workflows/openclaw-npm-dist-tags.yml`
152+
workflow to promote that stable version from `beta` to `latest`
166153
7. If the release intentionally published directly to `latest` and `beta`
167-
should follow the same stable build, run `OpenClaw NPM Release` with the same
168-
stable `tag`, `sync_stable_dist_tags=true`, `promote_beta_to_latest=false`,
169-
`preflight_only=false`, `preflight_run_id` empty, and `npm_dist_tag=latest`
154+
should follow the same stable build immediately, use that same private
155+
workflow to point both dist-tags at the stable version, or let its scheduled
156+
self-healing sync move `beta` later
170157

171-
The promotion and dist-tag sync modes still require the `npm-release`
172-
environment approval and a valid `NPM_TOKEN` accessible to that workflow run.
158+
The dist-tag mutation lives in the private repo for security because it still
159+
requires `NPM_TOKEN`, while the public repo keeps OIDC-only publish.
173160

174161
That keeps the direct publish path and the beta-first promotion path both
175162
documented and operator-visible.

0 commit comments

Comments
 (0)