chore(android): publish companion as raw APK instead of zip

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>
This commit is contained in:
Dorian 2026-06-23 09:40:34 +01:00
parent e825bbed73
commit 5c43e12782
5 changed files with 22 additions and 15 deletions

View File

@ -2,7 +2,7 @@
# Keep the served companion APK in sync with main on every push. # Keep the served companion APK in sync with main on every push.
# #
# When a push to main includes Android changes, rebuild the APK, refresh # When a push to main includes Android changes, rebuild the APK, refresh
# neode-ui/public/packages/archipelago-companion.apk.zip, commit it, and ask # neode-ui/public/packages/archipelago-companion.apk, commit it, and ask
# you to push again (so the refreshed APK rides along in the same push). # you to push again (so the refreshed APK rides along in the same push).
# #
# Enable once per clone: git config core.hooksPath .githooks # Enable once per clone: git config core.hooksPath .githooks
@ -40,7 +40,7 @@ fi
bash scripts/publish-companion-apk.sh || exit 0 bash scripts/publish-companion-apk.sh || exit 0
DEST="neode-ui/public/packages/archipelago-companion.apk.zip" DEST="neode-ui/public/packages/archipelago-companion.apk"
if git diff --cached --quiet -- "$DEST"; then if git diff --cached --quiet -- "$DEST"; then
exit 0 # APK unchanged — nothing to do exit 0 # APK unchanged — nothing to do
fi fi

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Build the Android companion app and publish it as the served download # Build the Android companion app and publish it as the served download
# (neode-ui/public/packages/archipelago-companion.apk.zip), then commit + push. # (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 # Use this INSTEAD of `git push` when shipping the companion app, so the
# downloadable APK on the node always matches what's on main. # downloadable APK on the node always matches what's on main.
@ -17,7 +18,8 @@ export JAVA_HOME="${JAVA_HOME:-/opt/homebrew/opt/openjdk@17}"
export ANDROID_HOME="${ANDROID_HOME:-$HOME/Library/Android/sdk}" export ANDROID_HOME="${ANDROID_HOME:-$HOME/Library/Android/sdk}"
APK="Android/app/build/outputs/apk/debug/app-debug.apk" APK="Android/app/build/outputs/apk/debug/app-debug.apk"
DEST="neode-ui/public/packages/archipelago-companion.apk.zip" DEST="neode-ui/public/packages/archipelago-companion.apk"
OLD_ZIP="neode-ui/public/packages/archipelago-companion.apk.zip"
echo "==> Building debug APK" echo "==> Building debug APK"
( cd Android && ./gradlew :app:assembleDebug --console=plain -q ) ( cd Android && ./gradlew :app:assembleDebug --console=plain -q )
@ -25,8 +27,11 @@ echo "==> Building debug APK"
echo "==> Publishing -> $DEST" echo "==> Publishing -> $DEST"
mkdir -p "$(dirname "$DEST")" mkdir -p "$(dirname "$DEST")"
rm -f "$DEST" cp "$APK" "$DEST"
( cd "$(dirname "$APK")" && zip -j -q "$ROOT/$DEST" "$(basename "$APK")" ) # 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" git add "$DEST"
if git diff --cached --quiet; then if git diff --cached --quiet; then

View File

@ -82,7 +82,7 @@ const STORAGE_KEY = 'neode_companion_intro_seen'
// Absolute URL so the QR works when scanned by a phone (a relative path has no // Absolute URL so the QR works when scanned by a phone (a relative path has no
// host to resolve). Points at the companion APK hosted on the 146 release server // host to resolve). Points at the companion APK hosted on the 146 release server
// (publicly reachable) rather than the local node's /packages copy. // (publicly reachable) rather than the local node's /packages copy.
const DEFAULT_DOWNLOAD_URL = 'http://146.59.87.168:3000/lfg2025/archy/raw/branch/main/neode-ui/public/packages/archipelago-companion.apk.zip' const DEFAULT_DOWNLOAD_URL = 'http://146.59.87.168:3000/lfg2025/archy/raw/branch/main/neode-ui/public/packages/archipelago-companion.apk'
const visible = ref(false) const visible = ref(false)
const qrDataUrl = ref('') const qrDataUrl = ref('')

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build the Archipelago companion debug APK and stage it as the served download # Build the Archipelago companion debug APK and stage it as the served download
# at neode-ui/public/packages/archipelago-companion.apk.zip. # at neode-ui/public/packages/archipelago-companion.apk (a plain APK, so a phone
# can install it straight from the link — no unzip step).
# #
# Run manually, or automatically via the pre-push hook (.githooks/pre-push). # Run manually, or automatically via the pre-push hook (.githooks/pre-push).
set -euo pipefail set -euo pipefail
@ -21,15 +22,16 @@ echo "publish-companion-apk: building debug APK…" >&2
( cd Android && JAVA_HOME="$JAVA" ANDROID_HOME="$SDK" ./gradlew -q :app:assembleDebug ) ( cd Android && JAVA_HOME="$JAVA" ANDROID_HOME="$SDK" ./gradlew -q :app:assembleDebug )
APK="Android/app/build/outputs/apk/debug/app-debug.apk" APK="Android/app/build/outputs/apk/debug/app-debug.apk"
DEST="neode-ui/public/packages/archipelago-companion.apk.zip" DEST="neode-ui/public/packages/archipelago-companion.apk"
OLD_ZIP="neode-ui/public/packages/archipelago-companion.apk.zip"
mkdir -p "$(dirname "$DEST")" mkdir -p "$(dirname "$DEST")"
TMP="$(mktemp -d)" cp "$APK" "$DEST"
cp "$APK" "$TMP/app-debug.apk"
# -X drops platform-specific extra fields for a stabler archive. # Drop the legacy zipped artifact so the served download is the raw APK only.
( cd "$TMP" && zip -q -X archipelago-companion.apk.zip app-debug.apk ) if [ -f "$OLD_ZIP" ]; then
cp "$TMP/archipelago-companion.apk.zip" "$DEST" git rm -q --ignore-unmatch "$OLD_ZIP" 2>/dev/null || rm -f "$OLD_ZIP"
rm -rf "$TMP" fi
git add "$DEST" git add "$DEST"
echo "publish-companion-apk: staged $DEST" >&2 echo "publish-companion-apk: staged $DEST" >&2