94 lines
5.0 KiB
Markdown
94 lines
5.0 KiB
Markdown
# Fork Android APK releases
|
||
|
||
The fork publishes signed APKs to the repository running the workflow using
|
||
`.gitea/workflows/android-apk.yml`. This is separate from upstream's EAS/store
|
||
release workflows. Fork APK builds disable Expo OTA updates so upstream JavaScript
|
||
cannot replace the fork's bundled code.
|
||
|
||
## One-time setup
|
||
|
||
Enable repository Actions and register a dedicated Linux runner with the
|
||
`android-apk` label. Use an isolated CI checkout, not a running T3 environment:
|
||
the build regenerates `apps/mobile/android`. Install Node 24.13.1 or later in
|
||
the supported Node 24 line, the repository's pinned pnpm version, Java 17,
|
||
Git, curl, tar, xz, and the Android SDK with accepted licenses. Set `ANDROID_HOME`
|
||
and `ANDROID_NDK_HOME` in the runner environment. Install the SDK/NDK versions
|
||
required by the current Expo/React Native dependencies and CMake 3.22.1.
|
||
Signing uses SDK build-tools 36.0.0 by default; override
|
||
`ANDROID_BUILD_TOOLS_VERSION` if needed. The terminal build script downloads
|
||
its pinned Zig compiler and Ghostty sources.
|
||
|
||
Configure these repository Actions secrets:
|
||
|
||
| Secret | Value |
|
||
| ----------------------- | ------------------------------------------------------ |
|
||
| `APK_KEYSTORE_BASE64` | Base64-encoded Android release keystore |
|
||
| `APK_KEYSTORE_PASSWORD` | Keystore password |
|
||
| `APK_KEY_ALIAS` | Signing key alias |
|
||
| `APK_KEY_PASSWORD` | Signing key password |
|
||
| `APK_RELEASE_TOKEN` | Token with repository release write access to the fork |
|
||
|
||
Reuse the signing key of the currently installed APK if you want an in-place
|
||
upgrade. Back up that key securely and keep it unchanged across releases. A new
|
||
key cannot upgrade an existing installation signed by another key; uninstalling
|
||
first deletes local app data. The workflow never publishes the generated
|
||
debug-signed intermediate APK: it re-signs and verifies the final artifact with
|
||
the configured release key before uploading.
|
||
|
||
## Repository moves
|
||
|
||
Android builds default to the baked-in repository URL
|
||
`https://git.molberg.cloud/alex/t3code`, so local builds work without release-source
|
||
configuration. CI overrides that default with the repository running the workflow. Set
|
||
`T3CODE_APK_REPOSITORY_URL` only when building for another full HTTPS repository URL. Public downloads
|
||
need no authentication; the CI token is still required to publish releases and
|
||
is never embedded in the APK.
|
||
|
||
Already-installed APKs retain their original repository API URL. After a move,
|
||
keep the old repository API and release assets reachable long enough to publish
|
||
and distribute an APK built for the new repository URL. Keep the same signing key
|
||
across the move and ensure the release token has write access to the new owner’s
|
||
repository.
|
||
|
||
## Local release
|
||
|
||
For a local build from a checkout, copy the example configuration and run the
|
||
release script exactly like the MG Utility release flow:
|
||
|
||
```sh
|
||
cp .env.release.example .env.release
|
||
$EDITOR .env.release
|
||
./scripts/release-apk.sh --dry-run # prints the next apk-<versionCode>
|
||
./scripts/release-apk.sh # builds, signs, uploads, publishes
|
||
```
|
||
|
||
`GITEA_TOKEN` (or `APK_RELEASE_TOKEN`) must be present in `.env.release`. The
|
||
keystore, Android SDK, NDK, and Expo toolchain still need to match the build
|
||
script. The release body defaults to a `production` JSON envelope
|
||
(`schema: 1, channel, versionCode, versionName, branch, commit, sha256`);
|
||
`APK_RELEASE_BODY` overrides the entire body when set. `APK_VERSION_CODE` pins
|
||
the next release only when it exceeds the highest existing `apk-*` tag on the
|
||
target Gitea repository.
|
||
|
||
## Publish an update
|
||
|
||
Push a tag of the form `apk-<versionCode>` on the commit to release. For example,
|
||
`git tag apk-1001` followed by `git push origin apk-1001`. Choose a number greater
|
||
than every previously installed build's Android version code, at most 2100000000. Do not reuse tags. The app's display version still comes from
|
||
`apps/mobile/app.config.ts`.
|
||
|
||
The workflow builds a universal release APK, attaches it and a SHA-256 checksum
|
||
to a draft release, then publishes only after both uploads succeed. If an upload
|
||
fails, delete the incomplete draft release before rerunning the job; do not
|
||
delete its Git tag. Release creation intentionally fails rather than overwriting
|
||
an existing release. Signing/build failures publish nothing.
|
||
|
||
On Android, open **Settings → Software Update → Check for updates**. The app asks
|
||
the public repository API for releases, selects the highest published
|
||
`apk-<versionCode>` release with its matching APK, and downloads it into app-owned
|
||
cache. It then opens Android’s package installer with the downloaded APK; the user
|
||
must confirm installation, and Android may first require permission to install
|
||
unknown apps from T3 Code. This is not a silent installer. Downloads require no
|
||
repository credentials, and the flow does not depend on the connected T3
|
||
environment. iOS, web, and desktop keep their existing update paths.
|