Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

Fix Android release runner and add isolated APK recovery (#7290)

Peter Chinman1926d1f0ee87
diff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.yml
index 6a86847eb5..6b8bd13188 100644
--- a/.github/workflows/release-production.yml
+++ b/.github/workflows/release-production.yml
@@ -2,9 +2,19 @@ name: Deploy Production Release
on:
release:
types: [released]
+ workflow_dispatch:
+ inputs:
+ release_tag:
+ description: Existing published production release to rebuild Android for (vYYYY.M.D.N)
+ required: true
+ type: string
+ publish_android:
+ description: Attach the verified APK to the existing release
+ default: false
+ type: boolean
concurrency:
- group: ${{ github.workflow }}
+ group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || 'production' }}
cancel-in-progress: false
env:
@@ -19,12 +29,22 @@ jobs:
timeout-minutes: 90
env:
CI: "true"
- RELEASE_TAG: ${{ github.event.release.tag_name }}
+ RELEASE_TAG: ${{ inputs.release_tag || github.event.release.tag_name }}
steps:
+ - name: Validate recovery release
+ if: github.event_name == 'workflow_dispatch'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ shell: bash
+ run: |
+ set -euo pipefail
+ [[ "$RELEASE_TAG" =~ ^v20[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]
+ gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json isDraft,isPrerelease \
+ | jq -e '.isDraft == false and .isPrerelease == false'
- name: Checkout release
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
- ref: ${{ github.sha }}
+ ref: ${{ inputs.release_tag && format('refs/tags/{0}', inputs.release_tag) || github.sha }}
persist-credentials: false
- name: Install Android SDK components
shell: bash
@@ -60,8 +80,31 @@ jobs:
VITE_OTEL_EXPORTER_URL: https://macro-prox-prod.macroverse.workers.dev/i/otlp/v1/traces
VITE_OTEL_ENV: prod
run: |
+ set -euo pipefail
+ # The Nix environment is already loaded. Do not reload it in nested
+ # bash processes and re-enable its local-development sccache wrapper.
+ # This ephemeral runner has no compiler cache/server to reuse.
+ unset BASH_ENV
+ export RUSTC_WRAPPER=""
+ cargo tauri --version
+ # Tauri has shipped both switch-only and value-taking APK/AAB flags.
+ # Nix and local installations can differ; select APK-only with either CLI.
+ android_help=$(cargo tauri android build --help)
+ apk_args=(--apk)
+ if [[ "$android_help" == *'--apk <APK>'* ]]; then
+ apk_args=(--apk true --aab false)
+ fi
just android-build --firebase-config "$RUNNER_TEMP/android-google-services.json" \
- --apk true --aab false --ci --config "$RUNNER_TEMP/android-release.json"
+ "${apk_args[@]}" --ci --config "$RUNNER_TEMP/android-release.json" \
+ 2>&1 | tee "$RUNNER_TEMP/android-build.log"
+ - name: Preserve Android build log
+ if: always()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
+ with:
+ name: android-build-log
+ path: ${{ runner.temp }}/android-build.log
+ if-no-files-found: warn
+ retention-days: 7
- name: Verify and collect APK
working-directory: apps/web
env:
@@ -93,13 +136,17 @@ jobs:
apps/web/tauri/src-tauri/gen/android/app/google-services.json \
"$RUNNER_TEMP/android-google-services.json"
rm -rf "$RUNNER_TEMP/android-signing"
- - name: Teardown Nix
- if: always()
- uses: ./.github/actions/teardown-nix
+ # This hosted runner has no separate /nix cache mount to detach. The cache
+ # teardown action's fuser -km /nix can kill the runner on its root filesystem.
upload-android:
name: Publish Android release artifact
needs: [build-android, deploy, deploy-sync-service, deploy-ai-editing-worker]
+ if: >-
+ ${{ !cancelled() && needs.build-android.result == 'success' &&
+ ((github.event_name == 'workflow_dispatch' && inputs.publish_android) ||
+ (github.event_name == 'release' && needs.deploy.result == 'success' &&
+ needs.deploy-sync-service.result == 'success' && needs.deploy-ai-editing-worker.result == 'success')) }}
runs-on: ubuntu-24.04
permissions:
contents: write
@@ -112,11 +159,12 @@ jobs:
- name: Attach APK and checksum to release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
with:
- tag_name: ${{ github.event.release.tag_name }}
+ tag_name: ${{ inputs.release_tag || github.event.release.tag_name }}
files: android-artifacts/*
fail_on_unmatched_files: true
deploy-cloud-storage:
+ if: github.event_name == 'release'
name: Deploy Cloud Storage Services
uses: ./.github/workflows/deploy_all_services.yml
with:
@@ -150,6 +198,7 @@ jobs:
secrets: inherit
build:
+ if: github.event_name == 'release'
name: Build Web App
runs-on: namespace-profile-linux-mid;overrides.cache-tag=web-ci
env:
diff --git a/docs/ANDROID_DEVELOPMENT.md b/docs/ANDROID_DEVELOPMENT.md
index 824da3ea88..2318406fbe 100644
--- a/docs/ANDROID_DEVELOPMENT.md
+++ b/docs/ANDROID_DEVELOPMENT.md
@@ -118,7 +118,9 @@ The GitHub Actions `ANDROID_RELEASE_DOPPLER_TOKEN` secret must have read access
`android-release/prd`, including both the signing JSON and pinned Firebase secret.
CI passes this dedicated read-only service token as `DOPPLER_TOKEN` only during
configuration retrieval. Signing files live in the runner's temporary directory
-and are removed even when the build fails; only APK/checksum files are uploaded.
+and are removed even when the build fails. Only APK/checksum files are attached
+to the release; the separate `android-build-log` Actions artifact is retained for
+seven days, including on failed builds.
Release tags must follow `vYYYY.M.D.N`, with a valid date, years 2000–2099, and a
daily revision from 0–99. Android's `versionCode` is `YYYYMMDDNN` (for example,
@@ -132,6 +134,22 @@ cloud-storage, sync-service, and AI editing worker deployments. Android failures
fail their job without blocking web/backend rollout. CI verification does not
replace the device qualification described above.
+To recover an Android artifact without redeploying production, manually run
+`release-production.yml` with `release_tag` set to an existing published
+production release. The source is checked out from that tag; web/backend jobs
+are skipped. `publish_android` defaults to false so the first run can validate
+the build and leave the APK in the `android-release` Actions artifact. Set it to
+true to attach the verified APK and checksum to the selected release:
+
+```sh
+gh workflow run release-production.yml --ref main -f release_tag=v2026.9.30.0 -f publish_android=true
+```
+
+The Android job uses an ephemeral GitHub-hosted runner without a separate Nix
+cache mount. Do not invoke the shared `teardown-nix` cache-volume action there:
+its `fuser -km /nix` can kill the runner when `/nix` is on the root filesystem,
+preventing GitHub from receiving the build logs. Let the hosted VM be discarded.
+
The public GitHub release receives `macro-<tag>-android-arm64.apk` and
`macro-<tag>-android-arm64.apk.sha256`. Share the APK's release download link;
recipients do not need GitHub access. They open the downloaded APK and allow