From b00450b4ab347ca74f37fdc20a63e8b1e2b966ed Mon Sep 17 00:00:00 2001 From: Saurabh Bhoir <63059109+saurabhbhoir456@users.noreply.github.com> Date: Sun, 6 Dec 2026 15:21:27 +0530 Subject: [PATCH] docs: complete the preview APK recipe and print versionCode (#26) --- .github/workflows/release-apk.yml | 4 +++- docs/devices.md | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-apk.yml b/.github/workflows/release-apk.yml index 91bfef6..b08741e 100644 --- a/.github/workflows/release-apk.yml +++ b/.github/workflows/release-apk.yml @@ -190,6 +190,7 @@ jobs: SHA256: ${{ steps.apk.outputs.sha256 }} CERT: ${{ steps.apk.outputs.cert }} BYTES: ${{ steps.apk.outputs.bytes }} + CODE: ${{ github.run_number }} run: | set -euo pipefail notes="$RUNNER_TEMP/notes.md" @@ -197,7 +198,8 @@ jobs: printf 'Hermit %s: a preview build to try Hermit on your phone and run the Device lab.\n\n' "$VERSION" printf -- '- **hermit-%s.apk**, %s bytes\n' "$VERSION" "$BYTES" printf -- "- SHA-256: \`%s\`\n" "$SHA256" - printf -- "- Signing certificate SHA-256: \`%s\`\n\n" "$CERT" + printf -- "- Signing certificate SHA-256: \`%s\`\n" "$CERT" + printf -- "- versionCode: \`%s\`\n\n" "$CODE" printf 'How to install it, check it and run the Device lab: https://github.com/%s/blob/main/docs/devices.md\n\n' "$GITHUB_REPOSITORY" printf "The model isn't in the APK. On first run Hermit downloads it once (about 530 MB) and checks it against its pinned SHA-256.\n" } > "$notes" diff --git a/docs/devices.md b/docs/devices.md index a8d6e20..e9b4cfc 100644 --- a/docs/devices.md +++ b/docs/devices.md @@ -41,7 +41,22 @@ erases Hermit's data, including the downloaded model. The preview APK is an ordinary release build of `apps/mobile`. Set up as [CONTRIBUTING.md](../CONTRIBUTING.md) says for the Android app, then build `:app:assembleRelease` instead of `:app:assembleDebug`. A release build carries the -app's code, so it runs without Metro. It signs with the key you name when Gradle runs, in the environment or as Gradle +app's code, so it runs without Metro. + +To rebuild a published preview from its tag, give the build the same version the release workflow gave it first. +`versionName` is the tag without the `v`; `versionCode` is the number printed in that release's notes. Run this from +the repository root, on the tag's commit (the values here are examples; use the ones your release's notes print): + +```sh +VERSION=0.1.0-preview.1 CODE=412 node -e ' + const fs = require("node:fs"); + const path = "apps/mobile/app.json"; + const app = JSON.parse(fs.readFileSync(path, "utf8")); + app.expo.version = process.env.VERSION; + app.expo.android.versionCode = Number(process.env.CODE); + fs.writeFileSync(path, JSON.stringify(app, null, 2) + "\n"); +' +``` It signs with the key you name when Gradle runs, in the environment or as Gradle properties (for example in `~/.gradle/gradle.properties`), never in a file in the repository: | Environment | Gradle property |