|
24 | 24 | options: |
25 | 25 | - beta |
26 | 26 | - 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 |
37 | 27 |
|
38 | 28 | 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 }} |
40 | 30 | cancel-in-progress: false |
41 | 31 |
|
42 | 32 | env: |
|
48 | 38 | # PLEASE DON'T ADD LONG-RUNNING OR FLAKY CHECKS TO THE npm RELEASE PATH. |
49 | 39 | # KEEP THIS WORKFLOW SHORT AND DETERMINISTIC OR IT CAN GET STUCK AND JEOPARDIZE THE RELEASE. |
50 | 40 | # 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. |
51 | 44 | preflight_openclaw_npm: |
52 | | - if: ${{ inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }} |
| 45 | + if: ${{ inputs.preflight_only }} |
53 | 46 | runs-on: blacksmith-32vcpu-ubuntu-2404 |
54 | 47 | permissions: |
55 | 48 | contents: read |
@@ -246,7 +239,7 @@ jobs: |
246 | 239 | if-no-files-found: error |
247 | 240 |
|
248 | 241 | validate_publish_request: |
249 | | - if: ${{ !inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }} |
| 242 | + if: ${{ !inputs.preflight_only }} |
250 | 243 | runs-on: blacksmith-32vcpu-ubuntu-2404 |
251 | 244 | permissions: |
252 | 245 | contents: read |
@@ -275,7 +268,7 @@ jobs: |
275 | 268 | # KEEP THE REAL RELEASE/PUBLISH PATH ON A GITHUB-HOSTED RUNNER. |
276 | 269 | # npm trusted publishing + provenance requires this to stay on ubuntu-latest. |
277 | 270 | needs: [validate_publish_request] |
278 | | - if: ${{ !inputs.preflight_only && !inputs.promote_beta_to_latest && !inputs.sync_stable_dist_tags }} |
| 271 | + if: ${{ !inputs.preflight_only }} |
279 | 272 | runs-on: ubuntu-latest |
280 | 273 | environment: npm-release |
281 | 274 | permissions: |
@@ -411,205 +404,3 @@ jobs: |
411 | 404 | publish_target="./${publish_target}" |
412 | 405 | fi |
413 | 406 | 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." |
0 commit comments