Serve the companion download as a plain .apk so a phone installs it straight from the link/QR with no unzip step. Repoint the in-app download URL, the ship + publish scripts, and the pre-push hook at archipelago-companion.apk, and drop the legacy .apk.zip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
1.6 KiB
Bash
Executable File
48 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Build the Android companion app and publish it as the served download
|
|
# (neode-ui/public/packages/archipelago-companion.apk — a plain APK a phone can
|
|
# install straight from the link), then commit + push.
|
|
#
|
|
# Use this INSTEAD of `git push` when shipping the companion app, so the
|
|
# downloadable APK on the node always matches what's on main.
|
|
#
|
|
# ./Android/ship-companion.sh
|
|
#
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
export JAVA_HOME="${JAVA_HOME:-/opt/homebrew/opt/openjdk@17}"
|
|
export ANDROID_HOME="${ANDROID_HOME:-$HOME/Library/Android/sdk}"
|
|
|
|
APK="Android/app/build/outputs/apk/debug/app-debug.apk"
|
|
DEST="neode-ui/public/packages/archipelago-companion.apk"
|
|
OLD_ZIP="neode-ui/public/packages/archipelago-companion.apk.zip"
|
|
|
|
echo "==> Building debug APK"
|
|
( cd Android && ./gradlew :app:assembleDebug --console=plain -q )
|
|
[ -f "$APK" ] || { echo "ERROR: APK not found at $APK" >&2; exit 1; }
|
|
|
|
echo "==> Publishing -> $DEST"
|
|
mkdir -p "$(dirname "$DEST")"
|
|
cp "$APK" "$DEST"
|
|
# Drop the legacy zipped artifact so the served download is the raw APK only.
|
|
if [ -f "$OLD_ZIP" ]; then
|
|
git rm -q --ignore-unmatch "$OLD_ZIP" 2>/dev/null || rm -f "$OLD_ZIP"
|
|
fi
|
|
|
|
git add "$DEST"
|
|
if git diff --cached --quiet; then
|
|
echo "==> Nothing to commit (working tree + APK unchanged)"
|
|
else
|
|
git commit -q -m "chore(android): update companion apk download"
|
|
echo "==> Committed"
|
|
fi
|
|
|
|
echo "==> Pushing $(git branch --show-current)"
|
|
# SHIP_COMPANION lets the pre-push guard know the APK was just refreshed.
|
|
SHIP_COMPANION=1 git push origin "$(git branch --show-current)"
|
|
echo "==> Done — companion APK published and pushed."
|