Files
PIKKIE/scripts/build-apk.sh
T
juli d24415ecf9 PIKKIE: picky issues keeper & knitpick ideas explorer
Self-hosted beta-tester issue tracker with a Kotlin Android companion.

- Bullet-point reports (classic and rapid fire), .txt/.md import,
  evidence by paste, drag, camera or gallery
- Projects, calibers (.22 -> 12 gauge) as weights, public overview
- Threaded discussions, "me too", admin flagging with messages and files
- Board with polls and an off-topic image board with link previews
- Profiles with avatars, in-app inbox, opt-in e-mail and phone alerts
- Invites, optional open sign-up, TOTP 2FA with admin policy
- MCP endpoint with per-user API keys
- QR login both ways, built for an HTTPS reverse proxy
- Encryption at rest for 2FA secrets and the SMTP password
- Android app with full tester/admin parity, in-app updates, no Google
  services required
- Interactive first-run tutorial
2026-11-10 23:51:30 +01:00

36 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the PIKKIE Android app and drops the APK in releases/.
# Signed release build when a keystore is configured (see docs in README), otherwise a debug build.
# The web app always serves the newest .apk in releases/ (or android/app/build/outputs/apk).
# ./scripts/build-apk.sh -> release build if PIKKIE_KEYSTORE is set, else debug build
# ./scripts/build-apk.sh --install -> also installs it on the connected phone (adb)
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT=$(pwd)
if [[ -z "${JAVA_HOME:-}" && -d /opt/homebrew/opt/openjdk@17 ]]; then export JAVA_HOME=/opt/homebrew/opt/openjdk@17; fi
if [[ -z "${ANDROID_HOME:-}" && -d /opt/homebrew/share/android-commandlinetools ]]; then export ANDROID_HOME=/opt/homebrew/share/android-commandlinetools; fi
export PATH="${JAVA_HOME:+$JAVA_HOME/bin:}$PATH"
[[ -f android/local.properties ]] || echo "sdk.dir=${ANDROID_HOME:?set ANDROID_HOME}" > android/local.properties
# Release signing: picked up from ~/.pikkie/release.env (outside the repo, never commit it).
SIGNING_ENV="${PIKKIE_SIGNING_ENV:-$HOME/.pikkie/release.env}"
if [[ -z "${PIKKIE_KEYSTORE:-}" && -f "$SIGNING_ENV" ]]; then source "$SIGNING_ENV"; fi
VERSION=$(sed -n 's/.*versionName = "\(.*\)".*/\1/p' android/app/build.gradle.kts | head -1)
if [[ -n "${PIKKIE_KEYSTORE:-}" ]]; then TASK=assembleRelease; VARIANT=release; SUFFIX=""; else TASK=assembleDebug; VARIANT=debug; SUFFIX="-debug"; fi
(cd android && ./gradlew "$TASK" --console=plain -q)
SRC=$(ls -t android/app/build/outputs/apk/$VARIANT/*.apk | head -1)
DEST="releases/pikkie-${VERSION}${SUFFIX}.apk"
rm -f releases/pikkie-*.apk # keep only the newest build in the repo
cp "$SRC" "$DEST"
echo "✔ $DEST ($(du -h "$DEST" | cut -f1)) — now served at /#/download"
if [[ "${1:-}" == "--install" ]]; then
adb install -r "$DEST"
adb reverse tcp:1312 tcp:1312 >/dev/null 2>&1 || true
adb shell am start -n nl.pikkie.app/.MainActivity >/dev/null
echo "✔ installed on $(adb shell getprop ro.product.model)"
fi