From ea536c4678873096febaf8fb1d8e2bfd8a4eb796 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Thu, 27 Aug 2026 12:30:23 +0200 Subject: [PATCH] fix(shorebird): don't pass 'latest' as a macOS release version A GitHub Actions `x && '' || y` expression can't produce an empty string (empty is falsy), so the 'latest' default leaked through verbatim and the patch script looked for a Shorebird release literally named "latest". Translate 'latest' to empty in the run step, and fail early with a clear hint when neither an explicit release_version nor ASC_MACOS_APP_ID (auto-detect) is available. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/patch.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 382958f7..829360c5 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -131,15 +131,27 @@ jobs: if: inputs.build_mac env: SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }} - # 'latest' is the workflow default; the script auto-detects the live - # READY_FOR_SALE version when RELEASE_VERSION is empty. - RELEASE_VERSION: ${{ inputs.release_version == 'latest' && '' || inputs.release_version }} + # The workflow's release_version defaults to the string 'latest'. A GHA + # `x && '' || y` expression can't yield an empty string (an empty string + # is falsy), so translate 'latest' to empty in the shell below instead. + INPUT_RELEASE_VERSION: ${{ inputs.release_version }} ASC_APP_ID: ${{ secrets.ASC_MACOS_APP_ID }} ASC_KEY_ID: ${{ secrets.APPSTORE_API_KEY }} ASC_ISSUER_ID: ${{ secrets.APPSTORE_API_ISSUER_ID }} ASC_API_KEY_PATH: ./private_keys/AuthKey_${{ secrets.APPSTORE_API_KEY }}.p8 SHOREBIRD_PATCH_ARGS: "--track ${{ inputs.track }} --allow-asset-diffs --allow-native-diffs --split-debug-info=symbols -- --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }} --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" - run: ruby scripts/shorebird_mas_patch.rb patch + run: | + # Pass an explicit x.y.z+build (the version you ran register-baseline for). + # 'latest' => empty, which makes the script auto-detect the live + # READY_FOR_SALE version — that path additionally needs ASC_MACOS_APP_ID. + if [ "$INPUT_RELEASE_VERSION" != "latest" ]; then + export RELEASE_VERSION="$INPUT_RELEASE_VERSION" + fi + if [ -z "${RELEASE_VERSION:-}" ] && [ -z "${ASC_APP_ID:-}" ]; then + echo "::error::Set release_version to the x.y.z+build you registered the MAS baseline for, or add the ASC_MACOS_APP_ID secret to auto-detect the live version." + exit 1 + fi + ruby scripts/shorebird_mas_patch.rb patch - name: 🚀 Shorebird Patch Android if: inputs.build_android