The owner puts the app in RuStore: the store updates it, and the store's build must neither update itself nor be counted by the site. A build type «rustore» on the same branch (not a branch to catch up each time): the release with SELF_UPDATE off — no check of releases (the check is what the site counts installations by), no download or install, no updates block in About, a release kept from the site's build forgotten; its manifest drops the install permissions and the installer's receiver. The full build only; the same package and key, so it goes over the site's one and back with the databases. release.sh builds it into dist-rustore and checks it asks for no install permission; the release workflow keeps it as the run's «rustore» artifact, not a file of the release. The site's builds are as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
2.1 KiB
Bash
Executable file
37 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Builds the two signed release APKs into androidApp/dist:
|
|
# ChessPenguin-<version>-android.apk Stockfish built in ("full")
|
|
# ChessPenguin-<version>-android-noengine.apk Stockfish downloaded in the app ("light")
|
|
# and, apart (not a file of the release), into androidApp/dist-rustore:
|
|
# ChessPenguin-<version>-rustore.apk the full one for RuStore: no updates of its
|
|
# own, no check the site counts
|
|
# The key comes from the environment or from ~/.config/chesspenguin/android/.env.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
env_file="${CP_SIGNING_ENV:-$HOME/.config/chesspenguin/android/.env}"
|
|
if [[ -z "${CP_KEYSTORE:-}" && -f "${env_file}" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "${env_file}"
|
|
set +a
|
|
fi
|
|
: "${CP_KEYSTORE:?no release key: set CP_KEYSTORE and the passwords, or CP_SIGNING_ENV}"
|
|
./gradlew --console=plain assembleFullRelease assembleLightRelease assembleFullRustore
|
|
version="$(sed -n 's/^version = "\(.*\)"/\1/p' ../Cargo.toml | head -n1)"
|
|
mkdir -p dist
|
|
cp app/build/outputs/apk/full/release/app-full-release.apk "dist/ChessPenguin-${version}-android.apk"
|
|
cp app/build/outputs/apk/light/release/app-light-release.apk "dist/ChessPenguin-${version}-android-noengine.apk"
|
|
mkdir -p dist-rustore
|
|
cp app/build/outputs/apk/full/rustore/app-full-rustore.apk "dist-rustore/ChessPenguin-${version}-rustore.apk"
|
|
build_tools="$(ls -d "${ANDROID_HOME:-$HOME/Android/Sdk}"/build-tools/* | sort -V | tail -n1)"
|
|
for apk in dist/ChessPenguin-"${version}"-android*.apk dist-rustore/ChessPenguin-"${version}"-rustore.apk; do
|
|
"${build_tools}/apksigner" verify "${apk}"
|
|
"${build_tools}/zipalign" -c -P 16 4 "${apk}"
|
|
done
|
|
(cd dist && sha256sum ChessPenguin-"${version}"-android*.apk > ChessPenguin-"${version}"-android.sha256)
|
|
# The store's build asks for nothing it would not need.
|
|
if "${build_tools}/aapt2" dump permissions "dist-rustore/ChessPenguin-${version}-rustore.apk" | grep -q 'INSTALL_PACKAGES'; then
|
|
echo "the RuStore build may install packages" >&2
|
|
exit 1
|
|
fi
|
|
ls -l dist dist-rustore
|