@@ -517,6 +517,8 @@ jobs:
517517 if : ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
518518 runs-on : blacksmith-32vcpu-ubuntu-2404
519519 timeout-minutes : 30
520+ outputs :
521+ npm_launcher_artifact_id : ${{ steps.npm_launcher.outputs.artifact-id }}
520522 env :
521523 T3CODE_CLERK_PUBLISHABLE_KEY : ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
522524 T3CODE_CLERK_JWT_TEMPLATE : ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
@@ -604,6 +606,22 @@ jobs:
604606 if-no-files-found : error
605607 retention-days : 1
606608
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+
607625 # One job per platform and architecture (see release-desktop.yml), each
608626 # gated only on the JS bundle. Windows targets build on Linux and run their
609627 # native checks on a Windows runner of their own architecture.
@@ -635,6 +653,8 @@ jobs:
635653 resource_key : darwin-arm64
636654 cli_archive : true
637655 launch_check : true
656+ # desktop_mac_x64 saves the shared pnpm store; this job finishes last.
657+ save_pnpm_store : false
638658
639659 desktop_mac_x64 :
640660 name : Desktop macOS x64
@@ -806,6 +826,24 @@ jobs:
806826 with :
807827 install-args : --filter=@t3tools/scripts...
808828
829+ # Overlaps the artifact downloads. The wait below ends it before any
830+ # workspace script runs, so the Play key lives only in this process.
831+ # `exec` lets the runner's stop signals reach node directly.
832+ - id : android_apk
833+ name : Download nightly Android APK
834+ if : needs.preflight.outputs.release_channel == 'nightly'
835+ background : true
836+ continue-on-error : true
837+ timeout-minutes : 5
838+ env :
839+ GOOGLE_PLAY_SERVICE_ACCOUNT_JSON : ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
840+ PACKAGE_NAME : com.t3tools.t3code
841+ APK_OUTPUT_DIR : ${{ runner.temp }}/android-apk
842+ run : |
843+ if [ -n "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
844+ exec node .github/scripts/mirror-play-apk.cjs
845+ fi
846+
809847 - name : Download all desktop artifacts
810848 uses : actions/download-artifact@v8
811849 with :
@@ -820,18 +858,6 @@ jobs:
820858 merge-multiple : true
821859 path : release-assets
822860
823- - name : Download internal Android APK for Nightly
824- if : needs.preflight.outputs.release_channel == 'nightly'
825- continue-on-error : true
826- env :
827- GOOGLE_PLAY_SERVICE_ACCOUNT_JSON : ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
828- PACKAGE_NAME : com.t3tools.t3code
829- APK_OUTPUT_DIR : release-assets
830- run : |
831- if [ -n "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
832- node .github/scripts/mirror-play-apk.cjs
833- fi
834-
835861 # Installers verify archives against this file, so it is written from the
836862 # signed bytes that get uploaded, never from an earlier stage.
837863 - name : Write CLI archive checksums
@@ -848,6 +874,10 @@ jobs:
848874 sha256sum "${archives[@]}" > SHA256SUMS
849875 cat SHA256SUMS
850876
877+ # Always runs, even after a failed step, and keeps that failure.
878+ - name : Wait for nightly Android APK
879+ wait : android_apk
880+
851881 # The desktop build omits the publish config for preview versions, so
852882 # electron-builder emits no updater manifests for them. Refuse to publish
853883 # if one shows up anyway: a `latest*.yml` or `nightly*.yml` on a preview
@@ -913,10 +943,13 @@ jobs:
913943 echo 'release-assets/*.yml'
914944 fi
915945 echo 'release-assets/*.tar.gz'
916- # Only list APKs when Play has a processed internal build available.
917- for apk in release-assets/*.apk; do
918- [[ -f "$apk" ]] && echo "$apk"
919- done
946+ # A failed or timed-out fetch can leave partial bytes, so list the APK
947+ # only when this attempt's fetch succeeded and Play had one ready.
948+ if [[ "${{ steps.android_apk.outcome }}" == "success" ]]; then
949+ for apk in "$RUNNER_TEMP"/android-apk/*.apk; do
950+ [[ -f "$apk" ]] && echo "$apk"
951+ done
952+ fi
920953 echo 'release-assets/SHA256SUMS'
921954 echo 'EOF'
922955 } >> "$GITHUB_OUTPUT"
@@ -1010,34 +1043,65 @@ jobs:
10101043 # nothing resolves unless asked for by name.
10111044 publish_cli :
10121045 name : Publish CLI to npm
1013- needs : [preflight, release]
1046+ needs : [preflight, build_bundle, release]
10141047 if : ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
10151048 runs-on : ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
10161049 timeout-minutes : 15
10171050 permissions :
10181051 contents : read
10191052 id-token : write
10201053 steps :
1054+ # Only what setup-ci-deps reads to install the project's Node and npm.
10211055 - name : Checkout
10221056 uses : actions/checkout@v6
10231057 with :
10241058 ref : ${{ needs.preflight.outputs.ref }}
10251059 sparse-checkout : |
1026- /*
1027- !/.repos/
1060+ /.github/actions/setup-ci-deps/
1061+ /package.json
1062+ /pnpm-workspace.yaml
10281063 sparse-checkout-cone-mode : false
10291064
1030- - name : Setup dependencies
1065+ - name : Setup Node.js
10311066 uses : ./.github/actions/setup-ci-deps
10321067 with :
1033- install-args : --filter=t3... --filter=@t3tools/scripts...
1068+ install : " false "
10341069
1035- - name : Build the npm launcher
1036- run : node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
1070+ # Bind to build_bundle's exact upload: a name lookup takes the newest
1071+ # same-name artifact, and an empty ID downloads every artifact in the
1072+ # run. A later same-name upload hides this ID, so the download fails.
1073+ - name : Check the npm launcher artifact ID
1074+ env :
1075+ ARTIFACT_ID : ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1076+ run : |
1077+ if [[ ! "$ARTIFACT_ID" =~ ^[1-9][0-9]*$ ]]; then
1078+ echo "::error::build_bundle gave no valid npm-launcher artifact ID: '$ARTIFACT_ID'." >&2
1079+ exit 1
1080+ fi
1081+
1082+ - name : Download the npm launcher
1083+ uses : actions/download-artifact@v8
1084+ with :
1085+ artifact-ids : ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1086+ path : npm-packages
1087+ digest-mismatch : error
1088+
1089+ - name : Check the npm launcher version
1090+ env :
1091+ RELEASE_VERSION : ${{ needs.preflight.outputs.version }}
1092+ run : |
1093+ built="$(tar -xzOf npm-packages/t3.tgz package/package.json | jq -r .version)"
1094+ if [[ "$built" != "$RELEASE_VERSION" ]]; then
1095+ echo "::error::npm-launcher holds t3@$built, expected t3@$RELEASE_VERSION." >&2
1096+ exit 1
1097+ fi
10371098
10381099 - name : Publish the npm launcher
1100+ env :
1101+ DIST_TAG : ${{ needs.preflight.outputs.cli_dist_tag }}
10391102 run : |
1040- if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
1103+ # The ./ keeps npm from reading the path as a GitHub owner/repo spec.
1104+ if ! npm publish --access public --tag "$DIST_TAG" --provenance ./npm-packages/t3.tgz; then
10411105 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
10421106 exit 1
10431107 fi
0 commit comments