chore(android): add companion APK auto-publish hook + script
scripts/publish-companion-apk.sh builds the debug APK and refreshes the served download neode-ui/public/packages/archipelago-companion.apk.zip; .githooks/pre-push runs it on every push to main that touches Android. Enable per clone with git config core.hooksPath .githooks Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
dcedf9582a
commit
07b611d07d
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the Archipelago companion debug APK and stage it as the served download
|
||||
# at neode-ui/public/packages/archipelago-companion.apk.zip.
|
||||
#
|
||||
# Run manually, or automatically via the pre-push hook (.githooks/pre-push).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(git rev-parse --show-toplevel)"
|
||||
cd "$ROOT"
|
||||
|
||||
JAVA="${JAVA_HOME:-/opt/homebrew/opt/openjdk@17}"
|
||||
SDK="${ANDROID_HOME:-$HOME/Library/Android/sdk}"
|
||||
|
||||
if [ ! -x "$JAVA/bin/java" ] || [ ! -d "$SDK" ]; then
|
||||
echo "publish-companion-apk: JDK or Android SDK not found — skipping." >&2
|
||||
echo " (set JAVA_HOME and ANDROID_HOME to build the companion APK)" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "publish-companion-apk: building debug APK…" >&2
|
||||
( cd Android && JAVA_HOME="$JAVA" ANDROID_HOME="$SDK" ./gradlew -q :app:assembleDebug )
|
||||
|
||||
APK="Android/app/build/outputs/apk/debug/app-debug.apk"
|
||||
DEST="neode-ui/public/packages/archipelago-companion.apk.zip"
|
||||
mkdir -p "$(dirname "$DEST")"
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
cp "$APK" "$TMP/app-debug.apk"
|
||||
# -X drops platform-specific extra fields for a stabler archive.
|
||||
( cd "$TMP" && zip -q -X archipelago-companion.apk.zip app-debug.apk )
|
||||
cp "$TMP/archipelago-companion.apk.zip" "$DEST"
|
||||
rm -rf "$TMP"
|
||||
|
||||
git add "$DEST"
|
||||
echo "publish-companion-apk: staged $DEST" >&2
|
||||
Reference in New Issue
Block a user