8181 required : false
8282 default : " "
8383 type : string
84+ # Whether this job saves the workspace pnpm store. Release's two Macs
85+ # install the same store on the same runner type, so only one saves it.
86+ save_pnpm_store :
87+ required : false
88+ default : true
89+ type : boolean
8490 version :
8591 required : true
8692 type : string
@@ -263,6 +269,7 @@ jobs:
263269 uses : ./.github/actions/setup-ci-deps
264270 with :
265271 install-args : --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
272+ save-pnpm-store : ${{ inputs.save_pnpm_store }}
266273 env :
267274 pnpm_config_cache_dir : ${{ runner.temp }}/pnpm-metadata
268275
@@ -483,6 +490,7 @@ jobs:
483490 run : command -v patchelf || { sudo apt-get update && sudo apt-get install -y patchelf; }
484491
485492 - name : Build CLI archive
493+ id : build_cli
486494 if : inputs.cli_archive
487495 shell : bash
488496 env :
@@ -500,30 +508,45 @@ jobs:
500508 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME : ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
501509 run : |
502510 set -euo pipefail
503- if [[ "${{ inputs.platform }}" == "mac" && -n "${APPLE_API_KEY:-}" ]]; then
504- key_path="$RUNNER_TEMP/AuthKey_cli_${APPLE_API_KEY_ID}.p8"
505- printf '%s' "$APPLE_API_KEY" > "$key_path"
506- export APPLE_API_KEY="$key_path"
511+ extra_args=()
512+ if [[ "${{ inputs.platform }}" == "mac" ]]; then
513+ if [[ -n "${APPLE_API_KEY:-}" ]]; then
514+ key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
515+ trap 'rm -rf "$key_dir"' EXIT
516+ key_path="$key_dir/AuthKey.p8"
517+ (umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
518+ export APPLE_API_KEY="$key_path"
519+ fi
520+ # Older release refs lack deferred notarization and still wait here.
521+ cli_help="$(node scripts/build-cli-archive.ts --help)"
522+ if [[ "$cli_help" == *--notary-submission-file* ]]; then
523+ extra_args=(--notary-submission-file "$RUNNER_TEMP/t3-cli-notary-submission")
524+ echo "deferred_notarization=true" >> "$GITHUB_OUTPUT"
525+ fi
507526 fi
508527 node scripts/build-cli-archive.ts \
509528 --platform "${{ inputs.platform }}" \
510529 --arch "${{ inputs.arch }}" \
511530 --version "${{ inputs.version }}" \
512531 --resource-monitor-dir "$RUNNER_TEMP/cli-resource-monitor" \
513- --output-dir release-cli
532+ --output-dir release-cli \
533+ ${extra_args[@]+"${extra_args[@]}"}
514534
515535 - name : Smoke-test CLI archive
516536 if : inputs.cli_archive && inputs.verify_runner == ''
517537 shell : bash
518538 run : node scripts/smoke-cli-archive.ts --archive release-cli/* --expect-version "${{ inputs.version }}"
519539
540+ # macOS uploads its archive after "Await CLI notarization" instead.
520541 - name : Upload CLI archive
521- if : inputs.cli_archive
542+ if : inputs.cli_archive && inputs.platform != 'mac'
522543 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
523544 with :
524545 name : cli-${{ inputs.platform }}-${{ inputs.arch }}
525546 path : release-cli/*
526547 if-no-files-found : error
548+ # The archive is already gzip or zip; deflating it again saves under 2%.
549+ compression-level : 0
527550
528551 - name : Install Linux desktop build libraries
529552 if : inputs.platform == 'linux'
@@ -693,6 +716,39 @@ jobs:
693716
694717 vp run dist:desktop:artifact "${args[@]}"
695718
719+ # The CLI was submitted without waiting so Apple reviews it while the
720+ # desktop builds. Notarization does not change the archive bytes, but
721+ # nothing uploads them, so nothing publishes them, until Apple accepts.
722+ # With signing configured, a missing submission id fails this step.
723+ - name : Await CLI notarization
724+ if : inputs.cli_archive && inputs.platform == 'mac' && steps.build_cli.outputs.deferred_notarization == 'true'
725+ shell : bash
726+ env :
727+ APPLE_API_KEY : ${{ secrets.APPLE_API_KEY }}
728+ APPLE_API_KEY_ID : ${{ secrets.APPLE_API_KEY_ID }}
729+ APPLE_API_ISSUER : ${{ secrets.APPLE_API_ISSUER }}
730+ run : |
731+ set -euo pipefail
732+ if [[ -n "${APPLE_API_KEY:-}" ]]; then
733+ key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
734+ trap 'rm -rf "$key_dir"' EXIT
735+ key_path="$key_dir/AuthKey.p8"
736+ (umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
737+ export APPLE_API_KEY="$key_path"
738+ fi
739+ node scripts/build-cli-archive.ts await-notarization \
740+ --submission-file "$RUNNER_TEMP/t3-cli-notary-submission"
741+
742+ - name : Upload notarized CLI archive
743+ if : inputs.cli_archive && inputs.platform == 'mac'
744+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
745+ with :
746+ name : cli-${{ inputs.platform }}-${{ inputs.arch }}
747+ path : release-cli/*
748+ if-no-files-found : error
749+ # The archive is already gzip or zip; deflating it again saves under 2%.
750+ compression-level : 0
751+
696752 # Warm installs only touch the store index, so new content means a fetch.
697753 - name : Check staged install cache for new content
698754 id : stage_pnpm_changed
@@ -836,6 +892,8 @@ jobs:
836892 name : desktop-${{ inputs.platform }}-${{ inputs.arch }}
837893 path : release-publish/*
838894 if-no-files-found : error
895+ # Installers, zips and blockmaps are already compressed; deflating them again saves under 0.3%.
896+ compression-level : 0
839897
840898 - name : Upload resource monitor
841899 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
0 commit comments