whiskers.git / tools / release-apks.sh
1#!/usr/bin/env bash

Builds the three release APKs of one calendar version (arm64, universal, arm64-lite: no offline voice) into ~/whiskers-release/<version>/, one after another. The versionCode is yyyymmdd and the build of the day (01...). mise run release:apks -- 2026.10.5 2026100501 ONLY_LITE=1 builds just the lite one. The APKs are signed with the committed debug key (a fixture, not a release key). The service for the release is the static build (mise run whiskersd's binary for your own machine, or nix build '.?submodules=1#whiskersd-static' for one that runs anywhere); the release is made by hand. Needs what mise install and mise run android:sdk provide: ANDROID_HOME, ANDROID_NDK_HOME, gradle, cargo-ndk. USAGE arg "<version>" help="calendar version, e.g. 2026.10.5" USAGE arg "<code>" help="versionCode: yyyymmdd and the build of the day, e.g. 2026100501"

11set -euo pipefail
12ver=${1:?usage: release-apks.sh <version> <versionCode>}; code=${2:?usage: release-apks.sh <version> <versionCode>}
13out=$HOME/whiskers-release/$ver
14cd "$(dirname "$0")/.."
15mkdir -p "$out"
16jni=android/app/src/main/jniLibs/arm64-v8a
17voice=android/app/src/main/assets/offline-voice
18aside=$(mktemp -d)
19restore() { [ -d "$aside/voice" ] && { rm -rf "$voice"; mv "$aside/voice" "$voice"; }; for f in libonnxruntime.so libsherpa-onnx-jni.so; do [ -f "$aside/$f" ] && mv "$aside/$f" "$jni/$f"; done; true; }
20trap restore EXIT
21build() { # name abis [extra gradle args]
22  echo "=== building $1 ($2)"
23  WHISKERS_VERSION_NAME="$ver" WHISKERS_VERSION_CODE="$code" WHISKERS_ABIS="$2" tools/android-gradle.sh :app:assembleDebug ${3:-}
24  cp android/app/build/outputs/apk/debug/app-debug.apk "$out/whiskers-$ver-$1.apk"
25  ls -l "$out/whiskers-$ver-$1.apk"
26}
27if [ "${ONLY_LITE:-}" != 1 ]; then
28build arm64 arm64-v8a
29build universal arm64-v8a,armeabi-v7a,x86_64
30fi

lite: no offline voice (the library and the voice are what is left out)

32mv "$voice" "$aside/voice"; mv "$jni/libonnxruntime.so" "$jni/libsherpa-onnx-jni.so" "$aside/"
33build arm64-lite arm64-v8a -Pwhiskers.offlineVoice=false
34echo "=== done"