name: "Patch" on: workflow_dispatch: inputs: 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 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 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: '--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: '--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: '--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: Zip Symbols if: inputs.build_android || inputs.build_ios || inputs.build_mac run: zip -P "${{ secrets.ZIP_PASSWORD }}" -r symbols.zip symbols/ - name: Upload Symbols if: inputs.build_android || inputs.build_ios || inputs.build_mac uses: actions/upload-artifact@v4 with: overwrite: true name: Symbols path: symbols.zip windows: name: Patch Windows needs: guard if: inputs.build_windows runs-on: windows-latest 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: '--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