@@ -796,9 +796,7 @@ jobs:
796796 with :
797797 install-args : --filter=@t3tools/scripts...
798798
799- # Play's optional internal APK downloads in the background, beside the
800- # artifact downloads, into a directory outside release-assets. fd 9 holds
801- # the lock until the fetch exits. Only this process gets the Play key.
799+ # The fetch holds an exclusive lock on its log until it exits.
802800 - name : Start nightly Android APK download
803801 if : needs.preflight.outputs.release_channel == 'nightly'
804802 continue-on-error : true
@@ -808,12 +806,12 @@ jobs:
808806 APK_OUTPUT_DIR : ${{ runner.temp }}/android-apk
809807 run : |
810808 if [ -n "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
811- exec 9> "$RUNNER_TEMP/android-apk.lock "
809+ exec 9> "$RUNNER_TEMP/android-apk.log "
812810 flock -n 9
813- # shellcheck disable=SC2016 # the child shell expands these
814- setsid bash -c ' node .github/scripts/mirror-play-apk.cjs; echo "$?" > "$RUNNER_TEMP/android-apk.status"' \
815- < /dev/null > "$RUNNER_TEMP/android-apk.log" 2>&1 &
816- echo "$!" > "$RUNNER_TEMP/android-apk.pid"
811+ (
812+ timeout --kill-after=5s 5m node .github/scripts/mirror-play-apk.cjs &&
813+ touch "$RUNNER_TEMP/android-apk.ok"
814+ ) < /dev/null >&9 2>&1 &
817815 fi
818816
819817 - name : Download all desktop artifacts
@@ -893,28 +891,18 @@ jobs:
893891 fi
894892 done
895893
896- # Waits for the background fetch from "Start nightly Android APK download".
897- # Only a fetch that exited 0 on its own adds its APK. A timed-out one is
898- # killed and its directory is never read again.
899894 - name : Add nightly Android APK
900895 if : needs.preflight.outputs.release_channel == 'nightly'
901896 continue-on-error : true
902897 timeout-minutes : 6
903898 shell : bash
904899 run : |
905- lock="$RUNNER_TEMP/android-apk.lock"
906- # No lock means no Play key, so the download never started.
907- [[ -e "$lock" ]] || exit 0
908- status="timed out"
909- if flock -w 300 "$lock" true; then
910- status="$(cat "$RUNNER_TEMP/android-apk.status" 2>/dev/null || true)"
911- else
912- kill -- "-$(cat "$RUNNER_TEMP/android-apk.pid")" || true
913- fi
914- cat "$RUNNER_TEMP/android-apk.log" || true
915- if [[ "$status" != 0 ]]; then
916- echo "Android APK download failed (${status:-no exit status})." >&2
917- exit 1
900+ log="$RUNNER_TEMP/android-apk.log"
901+ [[ -f "$log" ]] || exit 0
902+ flock "$log" cat "$log"
903+ if [[ ! -f "$RUNNER_TEMP/android-apk.ok" ]]; then
904+ echo "::warning::Skipping the APK because the Play download failed or timed out."
905+ exit 0
918906 fi
919907 shopt -s nullglob
920908 apks=("$RUNNER_TEMP"/android-apk/*.apk)
0 commit comments