forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
451 lines (417 loc) 路 18.1 KB
/
Copy pathandroid-beta-release.yml
File metadata and controls
451 lines (417 loc) 路 18.1 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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
name: Android Beta Release
run-name: Android Beta ${{ inputs.operation }} ${{ inputs.target_ref }}@${{ inputs.target_sha }}
on:
workflow_dispatch:
inputs:
operation:
description: Upload and record, or recover recording after a terminal upload run failure
required: true
default: upload-and-record
type: choice
options:
- upload-and-record
- record-only
target_ref:
description: Canonical mobile release branch (release/YYYY.M.PATCH-mobile)
required: true
type: string
target_sha:
description: Exact lowercase commit SHA at the release branch head
required: true
type: string
source_run_id:
description: Original failed upload run ID; required only for record-only recovery
required: false
type: string
permissions: {}
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
NODE_VERSION: "24.19.0"
jobs:
authorize:
name: Authorize exact Android release candidate
if: inputs.operation == 'upload-and-record'
permissions:
actions: read
attestations: write
contents: read
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
actor: ${{ steps.authority.outputs.actor }}
approved: ${{ steps.authority.outputs.approved }}
build_timestamp: ${{ steps.authority.outputs.build-timestamp }}
receipt_digest: ${{ steps.authority.outputs.receipt-digest }}
run_id: ${{ steps.authority.outputs.run-id }}
target_ref: ${{ steps.authority.outputs.target-ref }}
target_sha: ${{ steps.authority.outputs.target-sha }}
triggering_actor: ${{ steps.authority.outputs.triggering-actor }}
steps:
- name: Checkout trusted mobile release authority
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
fetch-depth: 0
sparse-checkout: |
.github/actions/mobile-release-authority
scripts
apps/mobile/version.json
apps/android/version.json
apps/android/Config/Version.properties
apps/android/fastlane/metadata/android/en-US/release_notes.txt
apps/ios/CHANGELOG.md
- name: Setup trusted Node runtime
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Authorize Android beta release
id: authority
uses: ./.github/actions/mobile-release-authority
with:
operation: authorize
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ inputs.target_ref }}
target-sha: ${{ inputs.target_sha }}
authority-run-id: ${{ github.run_id }}
actor: ${{ github.actor }}
triggering-actor: ${{ github.triggering_actor }}
release:
name: Upload and record Android beta
needs: authorize
if: inputs.operation == 'upload-and-record' && needs.authorize.outputs.approved == 'true'
permissions:
actions: read
attestations: read
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 120
environment: android-beta-release
concurrency:
group: android-beta-release-ai.openclaw.app
cancel-in-progress: false
env:
BUILD_TIMESTAMP: ${{ needs.authorize.outputs.build_timestamp }}
RELEASE_TARGET_SHA: ${{ needs.authorize.outputs.target_sha }}
steps:
- name: Checkout approved release target
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_TARGET_SHA }}
fetch-depth: 0
persist-credentials: false
- name: Checkout trusted mobile release authority
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
path: apps/android/build/mobile-release-ci/authority
persist-credentials: false
fetch-depth: 0
sparse-checkout: |
.github/actions/mobile-release-authority
scripts
apps/mobile/version.json
apps/android/version.json
apps/android/Config/Version.properties
apps/android/fastlane/metadata/android/en-US/release_notes.txt
apps/ios/CHANGELOG.md
- name: Setup trusted Node runtime
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Prepare trusted Linux Android tooling
shell: bash
run: |
set -euo pipefail
test "$RUNNER_OS/$RUNNER_ARCH" = "Linux/X64"
for executable in /usr/bin/apt-get /usr/bin/sudo /usr/bin/timeout; do
test -x "$executable"
done
apt_source="/etc/apt/sources.list.d/ubuntu.sources"
apt_source_parts="$RUNNER_TEMP/openclaw-android-apt-sourceparts-disabled"
test -s "$apt_source"
if [[ -e "$apt_source_parts" || -L "$apt_source_parts" ]]; then
echo "::error::Task-private APT source-parts path must remain absent"
exit 1
fi
apt_options=(
-o "Dir::Etc::sourcelist=$apt_source"
-o "Dir::Etc::sourceparts=$apt_source_parts"
)
/usr/bin/timeout --signal=TERM --kill-after=10s 300s \
/usr/bin/sudo env DEBIAN_FRONTEND=noninteractive \
/usr/bin/apt-get "${apt_options[@]}" update
/usr/bin/timeout --signal=TERM --kill-after=10s 300s \
/usr/bin/sudo env DEBIAN_FRONTEND=noninteractive \
/usr/bin/apt-get "${apt_options[@]}" install \
-y --no-install-recommends acl imagemagick
test -x /usr/bin/convert
test -x /usr/bin/identify
trusted_root="apps/android/build/mobile-release-ci/authority"
adapter_path="scripts/android-sips-linux.sh"
test "$(git -C "$trusted_root" rev-parse HEAD)" = "$GITHUB_WORKFLOW_SHA"
read -r adapter_mode adapter_type adapter_oid adapter_name < <(
git -C "$trusted_root" ls-tree HEAD -- "$adapter_path"
)
if [[ "$adapter_mode" != "100755" || "$adapter_type" != "blob" ||
"$adapter_name" != "$adapter_path" ]]; then
echo "::error::Trusted Linux screenshot adapter is not a committed executable file"
exit 1
fi
tool_dir="$RUNNER_TEMP/openclaw-android-tools"
adapter="$tool_dir/android-sips-linux.sh"
mkdir -p "$tool_dir"
git -C "$trusted_root" cat-file blob "$adapter_oid" >"$adapter"
chmod 700 "$adapter"
cmp -s "$trusted_root/$adapter_path" "$adapter"
- name: Setup Node environment
uses: ./.github/actions/setup-node-env
with:
cache-mode: off
install-bun: "true"
node-version: ${{ env.NODE_VERSION }}
- name: Setup Android toolchain
uses: ./.github/actions/setup-android-toolchain
with:
cache-mode: off
install-screenshot-emulators: "true"
- name: Verify Linux KVM acceleration
shell: bash
run: |
set -euo pipefail
verify_kvm_acceleration() {
local output_file="$1"
local raw_output="${output_file}.raw"
local accel_status
local accel_timed_out=false
if /usr/bin/timeout --signal=TERM --kill-after=2s 15s \
emulator -accel-check >"$raw_output" 2>&1; then
accel_status=0
else
accel_status=$?
fi
if [[ "$accel_status" == "124" || "$accel_status" == "137" ]]; then
accel_timed_out=true
fi
head -c 16384 "$raw_output" >"$output_file"
rm -f "$raw_output"
{
printf '\nexit_status=%s\n' "$accel_status"
printf 'timed_out=%s\n' "$accel_timed_out"
} >>"$output_file"
cat "$output_file"
if [[ "$accel_status" -ne 0 || "$accel_timed_out" != "false" ]]; then
echo "::error::Android emulator acceleration check failed"
return 1
fi
if ! grep -Eiq '\bKVM\b.*\b(available|usable)\b' "$output_file"; then
echo "::error::Android emulator did not confirm usable KVM acceleration"
return 1
fi
}
test "$RUNNER_OS/$RUNNER_ARCH" = "Linux/X64"
test -c /dev/kvm
current_user="$(id -un)"
/usr/bin/sudo /usr/bin/setfacl -m "u:${current_user}:rw" /dev/kvm
/usr/bin/getfacl -cp /dev/kvm | grep -Fqx "user:${current_user}:rw-"
KVM_DEVICE=/dev/kvm /bin/bash -c \
'test -c "$KVM_DEVICE" && test -r "$KVM_DEVICE" && test -w "$KVM_DEVICE"'
verify_kvm_acceleration "$RUNNER_TEMP/android-emulator-kvm-check.txt"
- name: Setup Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: "3.4.10"
bundler: "2.6.9"
bundler-cache: false
working-directory: apps/android
- name: Install locked Fastlane bundle
working-directory: apps/android
run: |
set -euo pipefail
bundle _2.6.9_ install --jobs 4 --retry 3
bundle _2.6.9_ check
test "$(bundle _2.6.9_ exec ruby -e 'require "fastlane"; print Fastlane::VERSION')" = "2.239.0"
- name: Revalidate release authority immediately before signing access
uses: ./apps/android/build/mobile-release-ci/authority/.github/actions/mobile-release-authority
with:
operation: revalidate
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ needs.authorize.outputs.target_ref }}
target-sha: ${{ env.RELEASE_TARGET_SHA }}
authority-run-id: ${{ needs.authorize.outputs.run_id }}
- name: Create apps-signing read token
id: apps-signing-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: "2729701"
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: openclaw
repositories: apps-signing
permission-contents: read
- name: Revalidate release authority immediately before Android signing checkout
uses: ./apps/android/build/mobile-release-ci/authority/.github/actions/mobile-release-authority
with:
operation: revalidate
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ needs.authorize.outputs.target_ref }}
target-sha: ${{ env.RELEASE_TARGET_SHA }}
authority-run-id: ${{ needs.authorize.outputs.run_id }}
- name: Checkout encrypted Android signing assets
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: openclaw/apps-signing
ref: main
path: apps/android/build/release-signing/apps-signing
token: ${{ steps.apps-signing-token.outputs.token }}
persist-credentials: false
- name: Revalidate release authority immediately before Android signing materialization
uses: ./apps/android/build/mobile-release-ci/authority/.github/actions/mobile-release-authority
with:
operation: revalidate
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ needs.authorize.outputs.target_ref }}
target-sha: ${{ env.RELEASE_TARGET_SHA }}
authority-run-id: ${{ needs.authorize.outputs.run_id }}
- name: Materialize Android release signing
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: node scripts/android-release-signing.mjs --mode materialize
- name: Refresh trusted authority before store access
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
path: apps/android/build/mobile-release-ci/sink
persist-credentials: false
fetch-depth: 0
sparse-checkout: |
.github/actions/mobile-release-authority
scripts
apps/mobile/version.json
apps/android/version.json
apps/android/Config/Version.properties
apps/android/fastlane/metadata/android/en-US/release_notes.txt
apps/ios/CHANGELOG.md
- name: Revalidate release authority immediately before upload
uses: ./apps/android/build/mobile-release-ci/sink/.github/actions/mobile-release-authority
with:
operation: revalidate
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ needs.authorize.outputs.target_ref }}
target-sha: ${{ env.RELEASE_TARGET_SHA }}
authority-run-id: ${{ needs.authorize.outputs.run_id }}
- name: Upload Android beta
env:
GOOGLE_PLAY_JSON_KEY_DATA: ${{ secrets.GOOGLE_PLAY_JSON_KEY_DATA }}
GOOGLE_PLAY_PACKAGE_NAME: ai.openclaw.app
GOOGLE_PLAY_RELEASE_STATUS: completed
GOOGLE_PLAY_TRACK: internal
GOOGLE_PLAY_VALIDATE_ONLY: "0"
OPENCLAW_BUILD_TIMESTAMP: ${{ env.BUILD_TIMESTAMP }}
OPENCLAW_MOBILE_RELEASE_AUTHORITY_RECEIPT_DIGEST: ${{ needs.authorize.outputs.receipt_digest }}
OPENCLAW_MOBILE_RELEASE_INTENT_PATH: ${{ runner.temp }}/mobile-release-intent-android/intent.json
OPENCLAW_MOBILE_RELEASE_REF_MODE: intent
OPENCLAW_MOBILE_RELEASE_TARGET_REF: ${{ needs.authorize.outputs.target_ref }}
SIPS: ${{ runner.temp }}/openclaw-android-tools/android-sips-linux.sh
SUPPLY_CHANGES_NOT_SENT_FOR_REVIEW: "true"
SUPPLY_RESCUE_CHANGES_NOT_SENT_FOR_REVIEW: "false"
run: |
set -euo pipefail
rm -rf "$RUNNER_TEMP/mobile-release-intent-android"
pnpm android:release:upload
test -f "$RUNNER_TEMP/mobile-release-intent-android/intent.json"
test "$(wc -c < "$RUNNER_TEMP/mobile-release-intent-android/intent.json")" -le 4096
- name: Upload exact Android release intent
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: mobile-release-intent-android-${{ github.run_id }}-1
path: ${{ runner.temp }}/mobile-release-intent-android/intent.json
if-no-files-found: error
retention-days: 30
- name: Checkout trusted mobile release recorder
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
path: .mobile-release-recorder
persist-credentials: false
fetch-depth: 0
sparse-checkout: |
.github/actions/mobile-release-authority
scripts
apps/mobile/version.json
apps/android/version.json
apps/android/Config/Version.properties
apps/android/fastlane/metadata/android/en-US/release_notes.txt
apps/ios/CHANGELOG.md
- name: Validate and record immutable Android release ref
uses: ./.mobile-release-recorder/.github/actions/mobile-release-authority
with:
operation: record
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ needs.authorize.outputs.target_ref }}
target-sha: ${{ env.RELEASE_TARGET_SHA }}
authority-run-id: ${{ needs.authorize.outputs.run_id }}
release-ref-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
recover-record:
name: Recover immutable Android release ref
if: inputs.operation == 'record-only'
permissions:
actions: read
attestations: read
contents: read
runs-on: ubuntu-latest
timeout-minutes: 20
environment: android-beta-release
concurrency:
group: android-beta-release-ai.openclaw.app
cancel-in-progress: false
steps:
- name: Checkout trusted mobile release recorder
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
fetch-depth: 0
sparse-checkout: |
.github/actions/mobile-release-authority
scripts
apps/mobile/version.json
apps/android/version.json
apps/android/Config/Version.properties
apps/android/fastlane/metadata/android/en-US/release_notes.txt
apps/ios/CHANGELOG.md
- name: Setup trusted Node runtime
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Validate and recover immutable Android release ref
uses: ./.github/actions/mobile-release-authority
with:
operation: record
platform: android
workflow-path: .github/workflows/android-beta-release.yml
workflow-full-ref: ${{ github.workflow_ref }}
workflow-sha: ${{ github.workflow_sha }}
target-ref: ${{ inputs.target_ref }}
target-sha: ${{ inputs.target_sha }}
authority-run-id: ${{ inputs.source_run_id }}
recovery: "true"
release-ref-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}