The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 02:00 UTC
ci(release): npm publish no longer checks out and installs the workspace (#31936)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Nov 6, 2026 at 13:09 UTC
cb8e0ded774d3b6f2a5ef607160cf9786313b5a7
2 files changed
+63
-12
.github/workflows/release.yml
+57
-8
@@ -517,6 +517,8 @@ jobs:
517
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
518
runs-on: blacksmith-32vcpu-ubuntu-2404
519
timeout-minutes: 30
520
+ outputs:
521
+ npm_launcher_artifact_id: ${{ steps.npm_launcher.outputs.artifact-id }}
522
env:
523
T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
524
T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
@@ -604,6 +606,22 @@ jobs:
606
if-no-files-found: error
607
retention-days: 1
608
609
+ # publish_cli publishes this exact tarball, so the trusted publisher
610
+ # needs no workspace checkout or install. It is version-matched here.
611
+ - name: Build the npm launcher
612
+ run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
613
+
614
+ # GitHub allows a failed-jobs rerun for 30 days. publish_cli downloads
615
+ # this upload by its ID, which a publish_cli-only rerun keeps.
616
+ - name: Upload the npm launcher
617
+ id: npm_launcher
618
+ uses: actions/upload-artifact@v7
619
+ with:
620
+ name: npm-launcher
621
+ path: npm-packages/t3.tgz
622
+ if-no-files-found: error
623
+ retention-days: 30
624
+
625
# One job per platform and architecture (see release-desktop.yml), each
626
# gated only on the JS bundle. Windows targets build on Linux and run their
627
# native checks on a Windows runner of their own architecture.
@@ -1023,7 +1041,7 @@ jobs:
1041
# nothing resolves unless asked for by name.
1042
publish_cli:
1043
name: Publish CLI to npm
1026
- needs: [preflight, release]
1044
+ needs: [preflight, build_bundle, release]
1045
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
1046
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
1047
timeout-minutes: 15
@@ -1031,26 +1049,57 @@ jobs:
1049
contents: read
1050
id-token: write
1051
steps:
1052
+ # Only what setup-ci-deps reads to install the project's Node and npm.
1053
- name: Checkout
1054
uses: actions/checkout@v6
1055
with:
1056
ref: ${{ needs.preflight.outputs.ref }}
1057
sparse-checkout: |
1039
- /*
1040
- !/.repos/
1058
+ /.github/actions/setup-ci-deps/
1059
+ /package.json
1060
+ /pnpm-workspace.yaml
1061
sparse-checkout-cone-mode: false
1062
1043
- - name: Setup dependencies
1063
+ - name: Setup Node.js
1064
uses: ./.github/actions/setup-ci-deps
1065
with:
1046
- install-args: --filter=t3... --filter=@t3tools/scripts...
1066
+ install: "false"
1067
1048
- - name: Build the npm launcher
1049
- run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
1068
+ # Bind to build_bundle's exact upload: a name lookup takes the newest
1069
+ # same-name artifact, and an empty ID downloads every artifact in the
1070
+ # run. A later same-name upload hides this ID, so the download fails.
1071
+ - name: Check the npm launcher artifact ID
1072
+ env:
1073
+ ARTIFACT_ID: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1074
+ run: |
1075
+ if [[ ! "$ARTIFACT_ID" =~ ^[1-9][0-9]*$ ]]; then
1076
+ echo "::error::build_bundle gave no valid npm-launcher artifact ID: '$ARTIFACT_ID'." >&2
1077
+ exit 1
1078
+ fi
1079
+
1080
+ - name: Download the npm launcher
1081
+ uses: actions/download-artifact@v8
1082
+ with:
1083
+ artifact-ids: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1084
+ path: npm-packages
1085
+ digest-mismatch: error
1086
+
1087
+ - name: Check the npm launcher version
1088
+ env:
1089
+ RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1090
+ run: |
1091
+ built="$(tar -xzOf npm-packages/t3.tgz package/package.json | jq -r .version)"
1092
+ if [[ "$built" != "$RELEASE_VERSION" ]]; then
1093
+ echo "::error::npm-launcher holds t3@$built, expected t3@$RELEASE_VERSION." >&2
1094
+ exit 1
1095
+ fi
1096
1097
- name: Publish the npm launcher
1098
+ env:
1099
+ DIST_TAG: ${{ needs.preflight.outputs.cli_dist_tag }}
1100
run: |
1053
- if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
1101
+ # The ./ keeps npm from reading the path as a GitHub owner/repo spec.
1102
+ if ! npm publish --access public --tag "$DIST_TAG" --provenance ./npm-packages/t3.tgz; then
1103
echo "::error::npm publish failed. Make sure package t3 has a trusted publisher registered for .github/workflows/release.yml (see docs/operations/release.md)." >&2
1104
exit 1
1105
fi
docs/operations/release.md
+6
-4
@@ -533,9 +533,11 @@ blockmaps, with a 60 MB maximum for a representative sidecar-to-sidecar update.
533
534
## 0) npm OIDC trusted publishing setup (CLI)
535
536
-After the GitHub Release is published, the workflow runs `node scripts/build-npm-launcher.ts`, then
537
-`node apps/server/scripts/cli.ts publish --packages-dir npm-packages`, which runs `npm publish` on
538
-`t3.tgz`. That is the only package published per release.
536
+`build_bundle` builds the version-matched `t3.tgz` with `node scripts/build-npm-launcher.ts` and
537
+uploads it as the `npm-launcher` artifact. After the GitHub Release is published, `publish_cli`
538
+checks out only what it needs to set up the project's Node.js, downloads that exact upload by the
539
+artifact ID `build_bundle` outputs (never by name), checks the tarball version, and runs
540
+`npm publish --provenance` on it. That is the only package published per release.
541
542
Checklist:
543
@@ -663,7 +665,7 @@ Checklist:
665
- preflight passes
666
- release quality checks pass
667
- `build_bundle` and all platform builds pass
666
- - `publish_cli` publishes the exact release version before the release job
668
+ - `publish_cli` publishes the exact release version after the release job
669
- release job uploads expected files
670
5. Smoke test downloaded artifacts.
671