Repository navigation
368 lines (323 loc) · 15.7 KB
/
Copy pathpatch.yml
File metadata and controls
368 lines (323 loc) · 15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
name: "Patch"
on:
workflow_dispatch:
inputs:
build_mac:
description: 'Patch for macOS'
required: false
default: true
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
build_linux:
description: 'Patch for Linux (x64; arm64 is not a Shorebird release)'
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 }}
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
- 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: inputs.build_mac
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 macOS (beta track)
if: inputs.build_mac && inputs.track == 'stable'
uses: shorebirdtech/shorebird-patch@v1
with:
platform: macos
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 }}'
- 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 }}'
# macOS, Android and iOS patches all emit --split-debug-info=symbols, so any
# of them produces a symbols/ dir to zip.
- name: Zip Symbols
if: inputs.build_mac || inputs.build_android || inputs.build_ios
run: zip -r symbols.zip symbols/
# Named after the patch/v<version>/<run number> tag the `tag` job pushes.
- name: Upload Symbols
if: inputs.build_mac || inputs.build_android || inputs.build_ios
uses: ./.github/actions/upload-symbols
with:
file: symbols.zip
name: patch-${{ github.run_number }}-apple-android.zip
token: ${{ secrets.SYMBOLS_UPLOAD_TOKEN }}
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
# Shorebird checks out its Flutter fork under a long temp path; without
# this a cold cache fails with "Filename too long" (Windows MAX_PATH).
- name: Enable git long paths
run: git config --system core.longpaths true
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Set Up Flutter
uses: ./.github/actions/setup-flutter
- 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 symbols-win.zip symbols-win/ build/windows/x64/runner/Release/*.pdb
- name: Upload Windows Symbols
uses: ./.github/actions/upload-symbols
with:
file: symbols-win.zip
name: patch-${{ github.run_number }}-windows.zip
token: ${{ secrets.SYMBOLS_UPLOAD_TOKEN }}
linux:
name: Patch Linux
needs: guard
if: inputs.build_linux
# Same runner as the build.yml release: patches must use the same toolchain.
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: Rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
uses: ./.github/actions/rename-pubspec-overrides
- name: Install Linux build dependencies
run: |
sudo apt-get update
# The runner image ships libunwind-14-dev, which conflicts with the
# libunwind-dev that libgstreamer1.0-dev needs.
sudo apt-get remove -y libunwind-14-dev || true
sudo apt-get install -y --no-install-recommends clang cmake ninja-build pkg-config \
libgtk-3-dev liblzma-dev libstdc++-12-dev libasound2-dev libpulse-dev libsecret-1-dev \
libayatana-appindicator3-dev libnotify-dev libkeybinder-3.0-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev libsqlite3-dev libudev-dev libevdev-dev
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Set Up Flutter
uses: ./.github/actions/setup-flutter
- name: 🚀 Shorebird Patch Linux
uses: shorebirdtech/shorebird-patch@v1
with:
platform: linux
release-version: ${{ inputs.release_version }}
args: '--track ${{ inputs.track }} --allow-asset-diffs --allow-native-diffs --obfuscate --split-debug-info=symbols-linux -- --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: 🚀 Shorebird Patch Linux (beta track)
if: inputs.track == 'stable'
uses: shorebirdtech/shorebird-patch@v1
with:
platform: linux
release-version: ${{ inputs.release_version }}
args: '--track beta --allow-asset-diffs --allow-native-diffs --obfuscate --split-debug-info=symbols-linux -- --dart-define=SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}'
- name: Zip Linux Symbols
run: zip -r symbols-linux.zip symbols-linux/
- name: Upload Linux Symbols
uses: ./.github/actions/upload-symbols
with:
file: symbols-linux.zip
name: patch-${{ github.run_number }}-linux.zip
token: ${{ secrets.SYMBOLS_UPLOAD_TOKEN }}
tag:
name: Tag source commit
needs: [build, windows, linux]
# Tag the commit this patch was built from, so every OTA patch is traceable
# to its source. Runs only when a patch actually succeeded: at least one
# platform job succeeded and neither failed. always() lets it evaluate even
# when a platform job was skipped (e.g. a Windows-only patch skips `build`);
# a skipped job's result is 'skipped', not 'failure', so it's tolerated. If
# the main-branch guard tripped, both patch jobs are skipped and this is
# skipped too — no tag off main. !cancelled() avoids tagging a cancelled run.
if: >-
always() && !cancelled() &&
(needs.build.result == 'success' || needs.windows.result == 'success' || needs.linux.result == 'success') &&
needs.build.result != 'failure' &&
needs.windows.result != 'failure' &&
needs.linux.result != 'failure'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checks out github.sha (fixed at dispatch) — the exact commit the patch
# was built from. Push the tag with the built-in GITHUB_TOKEN: this job
# grants it `contents: write` (above), it acts as github-actions[bot] —
# the same identity the tagger is set to below — and no tag protection
# blocks it. The PAT_TOKEN/TOKEN secrets are only read on this repo
# (PAT_TOKEN writes to prop; TOKEN's write scope lapsed after Jan 2026),
# so their persisted credentials 403 on the push. No submodules to tag.
- name: Checkout the patched commit
uses: actions/checkout@v3
with:
token: ${{ github.token }}
- name: Tag the source commit with the patch provenance
env:
TRACK: ${{ inputs.track }}
RELEASE_VERSION: ${{ inputs.release_version }}
BUILD_IOS: ${{ inputs.build_ios }}
BUILD_ANDROID: ${{ inputs.build_android }}
BUILD_MAC: ${{ inputs.build_mac }}
BUILD_WINDOWS: ${{ inputs.build_windows }}
BUILD_LINUX: ${{ inputs.build_linux }}
run: |
set -euo pipefail
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
tag="patch/v${version}/${GITHUB_RUN_NUMBER}"
# Which platforms this run patched (GHA booleans arrive as strings).
platforms=""
if [ "$BUILD_IOS" = "true" ]; then platforms="$platforms ios"; fi
if [ "$BUILD_ANDROID" = "true" ]; then platforms="$platforms android"; fi
if [ "$BUILD_MAC" = "true" ]; then platforms="$platforms macos"; fi
if [ "$BUILD_WINDOWS" = "true" ]; then platforms="$platforms windows"; fi
if [ "$BUILD_LINUX" = "true" ]; then platforms="$platforms linux"; fi
platforms="${platforms# }"
# Idempotent: a re-run reuses the run number, so don't fail if it exists.
if git ls-remote --tags origin "refs/tags/${tag}" | grep -q .; then
echo "Tag ${tag} already exists on origin — skipping."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${tag}" "${GITHUB_SHA}" \
-m "Shorebird patch (track ${TRACK})" \
-m "release_version: ${RELEASE_VERSION}" \
-m "platforms: ${platforms}" \
-m "run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
git push origin "refs/tags/${tag}"
echo "Tagged ${GITHUB_SHA} as ${tag}"