63 lines
1.8 KiB
Bash
Executable File
63 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds a release-signed Android App Bundle (.aab) for the Google Play Console.
|
|
# Requires env: YRXTALS_KEYSTORE, YRXTALS_STORE_PASSWORD, YRXTALS_KEY_PASSWORD
|
|
# Optional: YRXTALS_KEY_ALIAS (defaults to "yrxtals")
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/_env.sh"
|
|
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
if [[ -z "${YRXTALS_KEYSTORE:-}" ]]; then
|
|
cat <<EOF >&2
|
|
YRXTALS_KEYSTORE not set.
|
|
|
|
create a release keystore once with:
|
|
keytool -genkey -v -keystore ~/.android/yrxtals-release.jks \\
|
|
-keyalg RSA -keysize 4096 -validity 25000 -alias yrxtals
|
|
|
|
then export:
|
|
export YRXTALS_KEYSTORE=\$HOME/.android/yrxtals-release.jks
|
|
export YRXTALS_KEY_ALIAS=yrxtals
|
|
export YRXTALS_STORE_PASSWORD=<store-password>
|
|
export YRXTALS_KEY_PASSWORD=<key-password>
|
|
EOF
|
|
exit 2
|
|
fi
|
|
|
|
if [[ -z "${YRXTALS_STORE_PASSWORD:-}" || -z "${YRXTALS_KEY_PASSWORD:-}" ]]; then
|
|
echo "YRXTALS_STORE_PASSWORD and YRXTALS_KEY_PASSWORD must be set" >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [[ ! -f "$YRXTALS_KEYSTORE" ]]; then
|
|
echo "keystore not found at $YRXTALS_KEYSTORE" >&2
|
|
exit 2
|
|
fi
|
|
|
|
export YRXTALS_KEY_ALIAS="${YRXTALS_KEY_ALIAS:-yrxtals}"
|
|
|
|
bash "$SCRIPT_DIR/generate-icons.sh"
|
|
|
|
JNILIBS="$REPO_ROOT/android/app/src/main/jniLibs"
|
|
mkdir -p "$JNILIBS/arm64-v8a"
|
|
|
|
echo "→ cargo ndk -t arm64-v8a -P 28 -o $JNILIBS build --profile release"
|
|
( cd "$REPO_ROOT" && cargo ndk -t arm64-v8a -P 28 -o "$JNILIBS" build --profile release )
|
|
|
|
echo "→ gradlew :app:bundleRelease"
|
|
( cd "$REPO_ROOT/android" && ./gradlew :app:bundleRelease )
|
|
|
|
AAB="$REPO_ROOT/android/app/build/outputs/bundle/release/app-release.aab"
|
|
if [[ ! -f "$AAB" ]]; then
|
|
echo "expected aab missing at $AAB" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo
|
|
echo "signed aab: $AAB"
|
|
echo "applicationId: org.elseif.yrxtals"
|
|
echo "upload at https://play.google.com/console"
|