Skip to content

Commit 054e367

Browse files
authored
feat(android): publish signed APKs with stable releases (#101212)
* feat(android): publish signed release APKs * fix(android): preserve fallback corrections * test(android): isolate APK signer fixtures * docs: refresh generated docs map
1 parent dbba3d2 commit 054e367

19 files changed

Lines changed: 1099 additions & 62 deletions

‎.github/workflows/android-release.yml‎

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/workflows/openclaw-release-publish.yml‎

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ on:
7171

7272
permissions:
7373
actions: write
74+
attestations: read
7475
contents: write
7576

7677
concurrency:
@@ -461,6 +462,11 @@ jobs:
461462
publish:
462463
name: Publish plugins, then OpenClaw
463464
needs: [resolve_release_target]
465+
permissions:
466+
actions: write
467+
attestations: write
468+
contents: write
469+
id-token: write
464470
runs-on: ubuntu-latest
465471
timeout-minutes: 120
466472
environment: npm-release
@@ -487,6 +493,51 @@ jobs:
487493
with:
488494
install-bun: "false"
489495

496+
- name: Write Android release approval
497+
if: ${{ !contains(inputs.tag, '-alpha.') && !contains(inputs.tag, '-beta.') }}
498+
env:
499+
RELEASE_PUBLISH_BRANCH: ${{ github.ref_name }}
500+
RELEASE_PUBLISH_RUN_ID: ${{ github.run_id }}
501+
RELEASE_TAG: ${{ inputs.tag }}
502+
TARGET_SHA: ${{ needs.resolve_release_target.outputs.sha }}
503+
run: |
504+
set -euo pipefail
505+
approval_dir="${RUNNER_TEMP}/android-release-approval"
506+
mkdir -p "${approval_dir}"
507+
node --input-type=module <<'NODE'
508+
import { writeFileSync } from "node:fs";
509+
import { join } from "node:path";
510+
511+
const approval = {
512+
version: 1,
513+
repository: process.env.GITHUB_REPOSITORY,
514+
workflow: "OpenClaw Release Publish",
515+
parentRunId: process.env.RELEASE_PUBLISH_RUN_ID,
516+
workflowBranch: process.env.RELEASE_PUBLISH_BRANCH,
517+
releaseTag: process.env.RELEASE_TAG,
518+
targetSha: process.env.TARGET_SHA,
519+
};
520+
writeFileSync(
521+
join(process.env.RUNNER_TEMP, "android-release-approval", "approval.json"),
522+
`${JSON.stringify(approval, null, 2)}\n`,
523+
);
524+
NODE
525+
526+
- name: Attest Android release approval
527+
if: ${{ !contains(inputs.tag, '-alpha.') && !contains(inputs.tag, '-beta.') }}
528+
uses: actions/attest@a1948c3f048ba23858d222213b7c278aabede763 # v4.1.1
529+
with:
530+
subject-path: ${{ runner.temp }}/android-release-approval/approval.json
531+
532+
- name: Upload Android release approval
533+
if: ${{ !contains(inputs.tag, '-alpha.') && !contains(inputs.tag, '-beta.') }}
534+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
535+
with:
536+
name: android-release-approval-${{ github.run_id }}
537+
path: ${{ runner.temp }}/android-release-approval/approval.json
538+
if-no-files-found: error
539+
retention-days: 30
540+
490541
- name: Dispatch publish workflows
491542
env:
492543
GH_TOKEN: ${{ github.token }}
@@ -513,6 +564,10 @@ jobs:
513564
[[ "${RELEASE_TAG}" != *"-alpha."* && "${RELEASE_TAG}" != *"-beta."* ]]
514565
}
515566
567+
is_android_release() {
568+
[[ "${RELEASE_TAG}" =~ ^v[0-9]{4}\.[1-9][0-9]*\.[1-9][0-9]*(-[1-9][0-9]*)?$ ]]
569+
}
570+
516571
dispatch_workflow_at_ref() {
517572
local workflow_ref="$1"
518573
shift
@@ -942,13 +997,64 @@ jobs:
942997
}
943998
944999
publish_github_release() {
1000+
if is_android_release; then
1001+
verify_android_release_asset_contract
1002+
fi
9451003
if is_stable_release; then
9461004
verify_windows_release_asset_contract
9471005
fi
9481006
gh release edit "${RELEASE_TAG}" --repo "$GITHUB_REPOSITORY" --draft=false
9491007
echo "- GitHub release: https://github.com/${GITHUB_REPOSITORY}/releases/tag/${RELEASE_TAG}" >> "$GITHUB_STEP_SUMMARY"
9501008
}
9511009
1010+
verify_android_release_asset_contract() {
1011+
local actual_android_assets actual_digest expected_android_assets expected_digest expected_hash release_json verify_dir
1012+
local -a required_assets=(
1013+
"OpenClaw-Android.apk"
1014+
"OpenClaw-Android-SHA256SUMS.txt"
1015+
)
1016+
1017+
release_json="$(gh release view "${RELEASE_TAG}" --repo "${GITHUB_REPOSITORY}" --json assets,url)"
1018+
expected_android_assets="$(printf '%s\n' "${required_assets[@]}" | jq -R . | jq -sc 'sort')"
1019+
actual_android_assets="$(printf '%s' "${release_json}" | jq -c '
1020+
[.assets[]? | select(.name | startswith("OpenClaw-Android")) | .name] | sort
1021+
')"
1022+
if [[ "${actual_android_assets}" != "${expected_android_assets}" ]]; then
1023+
echo "Stable release Android asset names do not match the canonical contract." >&2
1024+
return 1
1025+
fi
1026+
1027+
verify_dir="${RUNNER_TEMP}/openclaw-android-release-contract"
1028+
rm -rf "${verify_dir}"
1029+
mkdir -p "${verify_dir}"
1030+
gh release download "${RELEASE_TAG}" \
1031+
--repo "${GITHUB_REPOSITORY}" \
1032+
--pattern "OpenClaw-Android.apk" \
1033+
--pattern "OpenClaw-Android-SHA256SUMS.txt" \
1034+
--dir "${verify_dir}"
1035+
(
1036+
cd "${verify_dir}"
1037+
sha256sum --strict --check OpenClaw-Android-SHA256SUMS.txt
1038+
)
1039+
expected_hash="$(awk '$2 == "OpenClaw-Android.apk" { print $1 }' "${verify_dir}/OpenClaw-Android-SHA256SUMS.txt")"
1040+
if [[ ! "${expected_hash}" =~ ^[a-f0-9]{64}$ ]]; then
1041+
echo "Android checksum manifest does not contain the canonical APK entry." >&2
1042+
return 1
1043+
fi
1044+
expected_digest="sha256:${expected_hash}"
1045+
actual_digest="$(printf '%s' "${release_json}" | jq -r '.assets[]? | select(.name == "OpenClaw-Android.apk") | .digest // empty')"
1046+
if [[ "${actual_digest}" != "${expected_digest}" ]]; then
1047+
echo "Android release APK digest does not match its checksum manifest." >&2
1048+
return 1
1049+
fi
1050+
gh attestation verify "${verify_dir}/OpenClaw-Android.apk" \
1051+
--repo "${GITHUB_REPOSITORY}" \
1052+
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/android-release.yml" \
1053+
--source-ref "refs/tags/${RELEASE_TAG}" \
1054+
--deny-self-hosted-runners
1055+
echo "- Android APK asset contract: verified" >> "${GITHUB_STEP_SUMMARY}"
1056+
}
1057+
9521058
verify_windows_release_asset_contract() {
9531059
local actual_companion_assets actual_digest asset_name expected_companion_assets expected_digest expected_hash expected_installer_names manifest_dir manifest_json manifest_path release_json
9541060
# Add future promoted installer names, such as MSIX x64/ARM64, here.
@@ -1041,6 +1147,21 @@ jobs:
10411147
wait_for_run windows-node-release.yml "${windows_node_run_id}"
10421148
}
10431149
1150+
promote_android_release_asset() {
1151+
if ! is_android_release; then
1152+
return 0
1153+
fi
1154+
1155+
android_release_run_id="$(dispatch_workflow_at_ref "${RELEASE_TAG}" android-release.yml \
1156+
-f tag="${RELEASE_TAG}" \
1157+
-f release_publish_run_id="${GITHUB_RUN_ID}" \
1158+
-f release_publish_branch="${CHILD_WORKFLOW_REF}" \
1159+
-f release_target_sha="${TARGET_SHA}" \
1160+
-f direct_release_recovery=false)"
1161+
echo "- Android release run ID: \`${android_release_run_id}\`" >> "${GITHUB_STEP_SUMMARY}"
1162+
wait_for_run android-release.yml "${android_release_run_id}"
1163+
}
1164+
10441165
upload_dependency_evidence_release_asset() {
10451166
local release_version download_dir asset_path asset_name artifact_name
10461167
release_version="${RELEASE_TAG#v}"
@@ -1180,7 +1301,7 @@ jobs:
11801301
}
11811302
11821303
append_release_proof_to_github_release() {
1183-
local release_version body_file notes_file evidence_path tarball integrity telegram_line clawhub_line clawhub_bootstrap_line clawhub_runtime_state_path windows_line
1304+
local release_version body_file notes_file evidence_path tarball integrity telegram_line clawhub_line clawhub_bootstrap_line clawhub_runtime_state_path android_line windows_line
11841305
11851306
release_version="${RELEASE_TAG#v}"
11861307
body_file="${RUNNER_TEMP}/release-body.md"
@@ -1203,6 +1324,10 @@ jobs:
12031324
if [[ -n "${windows_node_run_id// }" ]]; then
12041325
windows_line="- Windows Hub promotion: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${windows_node_run_id} from openclaw/openclaw-windows-node@${WINDOWS_NODE_TAG}"
12051326
fi
1327+
android_line=""
1328+
if [[ -n "${android_release_run_id// }" ]]; then
1329+
android_line="- Android APK: https://github.com/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}/OpenClaw-Android.apk (https://github.com/${GITHUB_REPOSITORY}/actions/runs/${android_release_run_id})"
1330+
fi
12061331
12071332
RELEASE_BODY_FILE="${body_file}" \
12081333
RELEASE_NOTES_FILE="${notes_file}" \
@@ -1220,6 +1345,7 @@ jobs:
12201345
CLAWHUB_LINE="${clawhub_line}" \
12211346
CLAWHUB_BOOTSTRAP_LINE="${clawhub_bootstrap_line}" \
12221347
TELEGRAM_LINE="${telegram_line}" \
1348+
ANDROID_LINE="${android_line}" \
12231349
WINDOWS_LINE="${windows_line}" \
12241350
node --input-type=module <<'NODE'
12251351
import { readFileSync, writeFileSync } from "node:fs";
@@ -1247,6 +1373,7 @@ jobs:
12471373
process.env.CLAWHUB_BOOTSTRAP_LINE,
12481374
`- OpenClaw npm publish: https://github.com/${process.env.RELEASE_REPO}/actions/runs/${process.env.OPENCLAW_NPM_RUN_ID}`,
12491375
process.env.TELEGRAM_LINE,
1376+
...(process.env.ANDROID_LINE ? [process.env.ANDROID_LINE] : []),
12501377
...(process.env.WINDOWS_LINE ? [process.env.WINDOWS_LINE] : []),
12511378
].join("\n");
12521379
@@ -1272,6 +1399,9 @@ jobs:
12721399
else
12731400
echo "- OpenClaw npm publish: skipped by input"
12741401
fi
1402+
if is_android_release && [[ "${PUBLISH_OPENCLAW_NPM}" == "true" ]]; then
1403+
echo "- Android APK: required before the GitHub release can be published"
1404+
fi
12751405
if is_stable_release && [[ "${PUBLISH_OPENCLAW_NPM}" == "true" ]]; then
12761406
echo "- Windows Hub promotion: required before the GitHub release can be published"
12771407
fi
@@ -1420,6 +1550,7 @@ jobs:
14201550
failed=0
14211551
openclaw_failed=0
14221552
windows_node_run_id=""
1553+
android_release_run_id=""
14231554
if [[ -n "${openclaw_pid}" ]] && ! wait "${openclaw_pid}"; then
14241555
failed=1
14251556
openclaw_failed=1
@@ -1449,6 +1580,9 @@ jobs:
14491580
verify_published_release true
14501581
fi
14511582
create_or_update_github_release
1583+
if ! promote_android_release_asset; then
1584+
failed=1
1585+
fi
14521586
upload_dependency_evidence_release_asset
14531587
upload_release_evidence_assets
14541588
if ! promote_windows_release_assets; then

‎apps/android/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
Adds multi-gateway support: the app remembers every paired gateway, lists them in Settings with a quick switcher on the Connect tab, and switches between them without pairing again. Credentials, device tokens, TLS trust, notification routing, chat history, and queued offline messages stay scoped to their gateway, and forgetting a gateway removes all of its stored state.
66

7+
Stable GitHub Releases now include a signed standalone Android APK with checksums and verifiable GitHub Actions provenance. (#9443)
8+
79
Android notification forwarding now excludes native WhatsApp, Telegram, Telegram X, Discord, and Signal channel apps to prevent duplicate cross-session replies. (#48516)
810

911
Assistant messages now offer a long-press Listen action with gateway TTS playback, on-device fallback, and tap-to-stop status.

‎apps/android/Config/ReleaseSigning.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"assetPath": "android/openclaw",
55
"uploadKeystoreEncryptedFile": "upload-keystore.jks.enc",
66
"gradlePropertiesEncryptedFile": "gradle.properties.enc",
7+
"apkCertificateSha256": "80dbc62315ea216dd6e8a7060735a866ddc464a48ed50fef29ff0550468b9a63",
78
"materializedRoot": "apps/android/build/release-signing",
89
"gradlePropertyNames": [
910
"OPENCLAW_ANDROID_STORE_FILE",

‎apps/android/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ MATCH_PASSWORD=<signing repo password> pnpm android:release:signing:check
6161
```
6262

6363
The signing sync pulls encrypted Android upload-key assets from the shared `apps-signing` repo and materializes decrypted files under `apps/android/build/release-signing/`.
64+
Standalone release APK verification also requires that key's public certificate SHA-256 fingerprint to match `Config/ReleaseSigning.json`.
6465

6566
Generate raw Google Play screenshots:
6667

@@ -86,6 +87,10 @@ the screenshots, then shuts down the emulator it started.
8687

8788
`pnpm android:bundle:release` is an alias for the same Fastlane archive lane.
8889

90+
Regular final and correction OpenClaw releases publish the signed third-party APK as `OpenClaw-Android.apk` with a checksum manifest and GitHub Actions provenance. `.github/workflows/android-release.yml` is the only automated GitHub Release upload path; `OpenClaw Release Publish` dispatches it while the canonical release is still a draft and blocks publication until the uploaded asset contract verifies.
91+
92+
The protected `android-release` environment supplies `MATCH_PASSWORD`; the repository's read-only GitHub App token checks out encrypted material from `openclaw/apps-signing`. The workflow builds the exact release tag, refuses to replace different existing bytes, and re-downloads the APK for checksum, certificate, and provenance verification.
93+
8994
`pnpm android:release:archive` is for local archive validation only. It is not a
9095
fallback upload path after `pnpm android:release:upload` fails.
9196

‎apps/android/VERSIONING.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,16 @@ Recommended workflow:
5252
6. Run `ANDROID_SCREENSHOT_AVD=<avd-name> pnpm android:screenshots` to refresh raw Google Play screenshots with a script-managed emulator, or run `pnpm android:screenshots` when exactly one ADB device is already connected.
5353
7. Run `pnpm android:release:archive` to produce the signed Play AAB and third-party APK.
5454
8. Run `pnpm android:release:upload` to upload metadata, screenshots, and the Play AAB to the configured Google Play track.
55-
9. Complete production rollout manually in Google Play Console when needed.
55+
9. For a regular final or correction OpenClaw release, let `OpenClaw Release Publish` dispatch the protected `Android Release` workflow. It builds the signed third-party APK from the exact tag and attaches the verified APK, checksum manifest, and GitHub provenance before the release draft can publish. Before tagging a correction with its own package version, increment the pinned `versionCode`; the workflow verifies it is higher than the preceding final or correction APK. A same-commit fallback correction reuses the base release's verified APK and adds provenance for the correction tag.
56+
10. Complete production rollout manually in Google Play Console when needed.
5657

5758
If `pnpm android:release:upload` fails, stop at that failure. Do not continue by
5859
uploading archived artifacts through `pnpm android:release:archive`,
5960
`pnpm android:release:metadata`, direct Fastlane lanes, Gradle release artifacts,
6061
Google Play API mutation commands, or Play Console mutation commands. Fix the
6162
failing release-lane step, then rerun `pnpm android:release:upload`.
6263

63-
The third-party flavor is archived as a signed APK for non-Play distribution. It is not uploaded by the Play release lane.
64+
The third-party flavor is archived as a signed APK for non-Play distribution. The Play release lane never uploads it. Official GitHub distribution is owned only by `.github/workflows/android-release.yml`, which publishes regular final and correction tags through the protected `android-release` environment as `OpenClaw-Android.apk`.
6465

6566
## Release SHA tracking
6667

‎apps/android/fastlane/SETUP.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Release rules:
100100
- `apps/android/CHANGELOG.md` is the Android-only changelog and release-note source.
101101
- `apps/android/fastlane/metadata/android/en-US/release_notes.txt` is generated from that changelog by `pnpm android:version:sync`.
102102
- `apps/android/Config/ReleaseSigning.json` pins the encrypted Android signing assets in the shared signing repo.
103+
- `apkCertificateSha256` in that manifest pins the upload certificate accepted for standalone release APKs; rotate it only with the encrypted keystore.
103104
- `MATCH_PASSWORD` enables Fastlane to pull encrypted Android signing assets into `apps/android/build/release-signing/` before release validation or archive builds.
104105
- Supported pinned Android versions use CalVer: `YYYY.M.D`.
105106
- `versionCode` uses `YYYYMMDDNN`, where `NN` is a two-digit build number for the pinned version.
@@ -113,6 +114,7 @@ Release rules:
113114
- `pnpm android:screenshots` builds and installs the Play debug app, launches deterministic screenshot scenes, and captures raw PNGs.
114115
- `pnpm android:release:archive` builds the signed Play AAB and third-party APK into `apps/android/build/release-artifacts/`.
115116
- `pnpm android:release:upload` uploads the Play AAB to the configured Google Play track. The default track is `internal`.
117+
- Stable GitHub Release APK publication is separate from Google Play: `OpenClaw Release Publish` dispatches `.github/workflows/android-release.yml`, whose protected `android-release` environment provides `MATCH_PASSWORD`; the repository GitHub App reads the encrypted signing repo.
116118
- Production promotion remains manual in Google Play Console.
117119
- If `pnpm android:release:upload` fails, agent-driven releases must stop and report the failing step. Do not fall back to `pnpm android:release:archive`, `pnpm android:release:metadata`, direct Fastlane lanes, Gradle release artifacts plus Google Play upload commands, or mobile release ref recording.
118120

0 commit comments

Comments
 (0)