@@ -716,7 +716,10 @@ jobs:
716716 name : Assemble multi-platform latest.json
717717 # Only tag-backed releases assemble latest.json. Branch workflow_dispatch
718718 # runs skip rolling-release uploads, so their archive URLs never exist.
719- if : github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.ref == format('v{0}', inputs.version))
719+ if : |
720+ always() &&
721+ needs.setup.result == 'success' &&
722+ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.ref == format('v{0}', inputs.version)))
720723 runs-on : ubuntu-latest
721724 needs : [setup, release, release-macos-x64, release-linux, release-windows]
722725 timeout-minutes : 10
@@ -733,27 +736,60 @@ jobs:
733736
734737 - name : Write signature files
735738 env :
739+ RESULT_ARM64 : ${{ needs.release.result }}
740+ RESULT_X64 : ${{ needs.release-macos-x64.result }}
741+ RESULT_LINUX : ${{ needs.release-linux.result }}
742+ RESULT_WIN : ${{ needs.release-windows.result }}
736743 SIG_ARM64 : ${{ needs.release.outputs.sig }}
737744 SIG_X64 : ${{ needs.release-macos-x64.outputs.sig }}
738745 SIG_LINUX : ${{ needs.release-linux.outputs.sig }}
739746 SIG_WIN : ${{ needs.release-windows.outputs.sig }}
740747 run : |
748+ set -euo pipefail
741749 mkdir -p /tmp/sigs
742- echo "$SIG_ARM64" > /tmp/sigs/darwin-aarch64.sig
743- echo "$SIG_X64" > /tmp/sigs/darwin-x86_64.sig
744- echo "$SIG_LINUX" > /tmp/sigs/linux-x86_64.sig
745- echo "$SIG_WIN" > /tmp/sigs/windows-x86_64.sig
750+
751+ write_sig() {
752+ local result="$1" platform="$2" sig="$3"
753+ if [[ "$result" == "success" ]]; then
754+ [[ -n "$sig" ]] || { echo "::error::Missing signature for successful platform: $platform"; exit 1; }
755+ printf '%s' "$sig" > "/tmp/sigs/${platform}.sig"
756+ fi
757+ }
758+
759+ write_sig "$RESULT_ARM64" darwin-aarch64 "$SIG_ARM64"
760+ write_sig "$RESULT_X64" darwin-x86_64 "$SIG_X64"
761+ write_sig "$RESULT_LINUX" linux-x86_64 "$SIG_LINUX"
762+ write_sig "$RESULT_WIN" windows-x86_64 "$SIG_WIN"
746763
747764 - name : Verify archive URLs are accessible
765+ env :
766+ RESULT_ARM64 : ${{ needs.release.result }}
767+ RESULT_X64 : ${{ needs.release-macos-x64.result }}
768+ RESULT_LINUX : ${{ needs.release-linux.result }}
769+ RESULT_WIN : ${{ needs.release-windows.result }}
770+ ARCHIVE_ARM64 : ${{ needs.release.outputs.archive_name }}
771+ ARCHIVE_X64 : ${{ needs.release-macos-x64.outputs.archive_name }}
772+ ARCHIVE_LINUX : ${{ needs.release-linux.outputs.archive_name }}
773+ ARCHIVE_WIN : ${{ needs.release-windows.outputs.archive_name }}
748774 run : |
749775 set -euo pipefail
750776 BASE="https://github.com/block/buzz/releases/download/buzz-desktop-latest"
777+ ARCHIVES=()
778+
779+ add_archive() {
780+ local result="$1" platform="$2" archive="$3"
781+ if [[ "$result" == "success" ]]; then
782+ [[ -n "$archive" ]] || { echo "::error::Missing archive name for successful platform: $platform"; exit 1; }
783+ ARCHIVES+=("$archive")
784+ fi
785+ }
751786
752- for name in \
753- "${{ needs.release.outputs.archive_name }}" \
754- "${{ needs.release-macos-x64.outputs.archive_name }}" \
755- "${{ needs.release-linux.outputs.archive_name }}" \
756- "${{ needs.release-windows.outputs.archive_name }}"; do
787+ add_archive "$RESULT_ARM64" darwin-aarch64 "$ARCHIVE_ARM64"
788+ add_archive "$RESULT_X64" darwin-x86_64 "$ARCHIVE_X64"
789+ add_archive "$RESULT_LINUX" linux-x86_64 "$ARCHIVE_LINUX"
790+ add_archive "$RESULT_WIN" windows-x86_64 "$ARCHIVE_WIN"
791+
792+ for name in "${ARCHIVES[@]}"; do
757793 echo "Checking $BASE/$name ..."
758794 success=false
759795 for attempt in 1 2 3; do
@@ -772,15 +808,35 @@ jobs:
772808 echo "All archive URLs verified."
773809
774810 - name : Generate unified latest.json
811+ env :
812+ RESULT_ARM64 : ${{ needs.release.result }}
813+ RESULT_X64 : ${{ needs.release-macos-x64.result }}
814+ RESULT_LINUX : ${{ needs.release-linux.result }}
815+ RESULT_WIN : ${{ needs.release-windows.result }}
816+ ARCHIVE_ARM64 : ${{ needs.release.outputs.archive_name }}
817+ ARCHIVE_X64 : ${{ needs.release-macos-x64.outputs.archive_name }}
818+ ARCHIVE_LINUX : ${{ needs.release-linux.outputs.archive_name }}
819+ ARCHIVE_WIN : ${{ needs.release-windows.outputs.archive_name }}
775820 run : |
821+ set -euo pipefail
776822 BASE="https://github.com/block/buzz/releases/download/buzz-desktop-latest"
823+ TRIPLES=()
824+
825+ add_triple() {
826+ local result="$1" platform="$2" archive="$3"
827+ if [[ "$result" == "success" ]]; then
828+ [[ -n "$archive" ]] || { echo "::error::Missing archive name for successful platform: $platform"; exit 1; }
829+ TRIPLES+=("${platform}:/tmp/sigs/${platform}.sig:${BASE}/${archive}")
830+ fi
831+ }
832+
833+ add_triple "$RESULT_ARM64" darwin-aarch64 "$ARCHIVE_ARM64"
834+ add_triple "$RESULT_X64" darwin-x86_64 "$ARCHIVE_X64"
835+ add_triple "$RESULT_LINUX" linux-x86_64 "$ARCHIVE_LINUX"
836+ add_triple "$RESULT_WIN" windows-x86_64 "$ARCHIVE_WIN"
777837
778- bash desktop/scripts/generate-oss-latest-json.sh "$VERSION" \
779- "darwin-aarch64:/tmp/sigs/darwin-aarch64.sig:${BASE}/${{ needs.release.outputs.archive_name }}" \
780- "darwin-x86_64:/tmp/sigs/darwin-x86_64.sig:${BASE}/${{ needs.release-macos-x64.outputs.archive_name }}" \
781- "linux-x86_64:/tmp/sigs/linux-x86_64.sig:${BASE}/${{ needs.release-linux.outputs.archive_name }}" \
782- "windows-x86_64:/tmp/sigs/windows-x86_64.sig:${BASE}/${{ needs.release-windows.outputs.archive_name }}" \
783- > latest.json
838+ [ "${#TRIPLES[@]}" -ge 3 ] || { echo "::error::too few platforms (${#TRIPLES[@]})"; exit 1; }
839+ bash desktop/scripts/generate-oss-latest-json.sh "$VERSION" "${TRIPLES[@]}" > latest.json
784840 cat latest.json
785841
786842 - name : Upload latest.json to rolling release
0 commit comments