Files
swiftcontrol/.github/workflows/patch.yml
Jonas Bark 08889a556b ci(patch): make platform selection work like the build pipeline
patch.yml referenced inputs.build_mac in three places but never declared it as
a workflow input, so it always evaluated falsy. Declared it, mirroring
build.yml's per-platform booleans. Default is false and the macOS patch step
stays disabled (#143) — the toggle only drives certificate install today, and
its description says so rather than implying macOS gets patched.

Also gated the macOS-runner job on the platforms it actually serves. A
Windows-only patch previously still spun up a macos-26 runner that checked out
the repo, installed Shorebird and Flutter, then ran no patch step at all.

The symbol zip/upload steps deliberately keep gating on android || ios only:
with the macOS patch step disabled, a macOS-only run produces no symbols/ and
`zip -r symbols.zip symbols/` would fail. Noted inline for whoever re-enables
#143.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PanTG9kRBi4QTQ2psvpTxP
2026-07-30 13:26:20 +02:00

227 lines
9.2 KiB
YAML

name: "Patch"
on:
workflow_dispatch:
inputs:
build_mac:
# Selecting this currently only installs the signing certificates: the
# macOS patch step itself stays disabled until
# https://github.com/OpenBikeControl/bikecontrol/issues/143 is fixed.
description: 'Patch for macOS (patch step disabled, see #143)'
required: false
default: false
type: boolean
build_windows:
description: 'Patch for Windows'
required: false
default: true
type: boolean
build_android:
description: 'Patch for Android'
required: false
default: true
type: boolean
build_ios:
description: 'Patch for iOS'
required: false
default: true
type: boolean
release_version:
description: 'Release version to patch'
required: false
default: latest
type: string
track:
description: 'Shorebird track (stable also patches beta so testers never lag)'
required: false
default: stable
type: choice
options:
- stable
- beta
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
FLUTTER_VERSION: 3.38.5
jobs:
guard:
name: Reject main branch
runs-on: ubuntu-latest
steps:
- name: Fail if dispatched from main
if: github.ref == 'refs/heads/main'
run: |
echo "::error::Patch workflow must not be run from the main branch. Dispatch it from a release branch instead."
exit 1
build:
name: Patch iOS, Android & macOS
needs: guard
# Without this, a Windows-only patch still spun up a macOS runner that
# checked out, installed Shorebird and Flutter, then ran no patch step.
if: inputs.build_mac || inputs.build_android || inputs.build_ios
runs-on: macos-26
permissions:
id-token: write
pages: write
contents: write
steps:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: Rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
uses: ./.github/actions/rename-pubspec-overrides
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Set Up Flutter
uses: ./.github/actions/setup-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install certificates
if: inputs.build_mac || inputs.build_ios
uses: ./.github/actions/install-certificates
with:
developer-id-application-p12-base64: ${{ secrets.DEVELOPER_ID_APPLICATION_P12_BASE64_MAC }}
developer-id-installer-p12-base64: ${{ secrets.DEVELOPER_ID_INSTALLER_P12_BASE64_MAC }}
p12-password: ${{ secrets.P12_PASSWORD }}
keychain-password: ${{ secrets.KEYCHAIN_PASSWORD }}
appstore-profile-ios-base64: ${{ secrets.APPSTORE_PROFILE_IOS_BASE64 }}
appstore-profile-macos-base64: ${{ secrets.APPSTORE_PROFILE_MACOS_BASE64 }}
appstore-profile-dev-ios-base64: ${{ secrets.APPSTORE_PROFILE_DEV_IOS_BASE64 }}
appstore-profile-liveactivity-base64: ${{ secrets.APPSTORE_PROFILE_LIVEACTIVITY_BASE64 }}
appstore-profile-liveactivity-debug-base64: ${{ secrets.APPSTORE_PROFILE_LIVEACTIVITY_DEBUG_BASE64 }}
- name: Decode Keystore
if: inputs.build_android
uses: ./.github/actions/decode-keystore
with:
keystore-base64: ${{ secrets.KEYSTORE_BASE64 }}
keystore-properties: ${{ secrets.KEYSTORE_PROPERTIES }}
- name: 🚀 Shorebird Patch macOS
if: false # patch doesn't work: https://github.com/OpenBikeControl/bikecontrol/issues/143
uses: shorebirdtech/shorebird-patch@v1
with:
platform: macos
release-version: ${{ inputs.release_version }}
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 }}'
- name: 🚀 Shorebird Patch Android
if: inputs.build_android
uses: shorebirdtech/shorebird-patch@v1
with:
platform: android
release-version: ${{ inputs.release_version }}
args: '--track ${{ inputs.track }} --allow-asset-diffs --allow-native-diffs --split-debug-info=symbols -- --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }} --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: 🚀 Shorebird Patch Android (beta track)
if: inputs.build_android && inputs.track == 'stable'
uses: shorebirdtech/shorebird-patch@v1
with:
platform: android
release-version: ${{ inputs.release_version }}
args: '--track beta --allow-asset-diffs --allow-native-diffs --split-debug-info=symbols -- --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }} --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: 🚀 Shorebird Patch iOS
if: inputs.build_ios
uses: shorebirdtech/shorebird-patch@v1
with:
platform: ios
release-version: ${{ inputs.release_version }}
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 }}'
- name: 🚀 Shorebird Patch iOS (beta track)
if: inputs.build_ios && inputs.track == 'stable'
uses: shorebirdtech/shorebird-patch@v1
with:
platform: ios
release-version: ${{ inputs.release_version }}
args: '--track beta --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 }}'
# build_mac is deliberately not part of these conditions: the macOS patch
# step is disabled (#143), so a macOS-only run produces no symbols/ and
# the zip would fail. Add it back when that patch step is re-enabled.
- name: Zip Symbols
if: inputs.build_android || inputs.build_ios
run: zip -P "${{ secrets.ZIP_PASSWORD }}" -r symbols.zip symbols/
- name: Upload Symbols
if: inputs.build_android || inputs.build_ios
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Symbols
path: symbols.zip
windows:
name: Patch Windows
needs: guard
if: inputs.build_windows
# Pinned to match build.yml: patches must use the same toolchain as the
# release build, and windows-latest now ships VS 2026 whose MSVC turns the
# STL1011 experimental-coroutine deprecation (hit by the C++/WinRT code in
# bluetooth_low_energy_windows / permission_handler_windows) into a hard
# compile error.
runs-on: windows-2025
steps:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: Rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
uses: ./.github/actions/rename-pubspec-overrides
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Set Up Flutter
uses: ./.github/actions/setup-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: 🚀 Shorebird Patch Windows
uses: shorebirdtech/shorebird-patch@v1
with:
platform: windows
release-version: ${{ inputs.release_version }}
args: '--track ${{ inputs.track }} --allow-asset-diffs --allow-native-diffs --split-debug-info=symbols-win -- --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: 🚀 Shorebird Patch Windows (beta track)
if: inputs.track == 'stable'
uses: shorebirdtech/shorebird-patch@v1
with:
platform: windows
release-version: ${{ inputs.release_version }}
args: '--track beta --allow-asset-diffs --allow-native-diffs --split-debug-info=symbols-win -- --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: Zip Windows Symbols
shell: pwsh
run: |
7z a -p"${{ secrets.ZIP_PASSWORD }}" symbols-win.zip symbols-win/ build/windows/x64/runner/Release/*.pdb
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Windows Symbols
path: symbols-win.zip