#!/bin/sh # Builds the Android app and offers it to phones through Check for updates. # # Usage (from app/ on main): sh tool/publish_apk.sh ["notes"] # The build number is minutes since the epoch, so every build is newer than # the last. The APK and version.json go to build/updates/ (kept across preview # publishes) and are copied into the live preview at build/web/updates/, # served behind the web login at https://:8096/updates/. Never restarts # any server. set -eu notes="${1:-}" # The phone's default server: the web proxy over Tailscale (sign in once in # Settings). Override with PIPELINES_SERVER_URL. server="${PIPELINES_SERVER_URL:-wss://alans-macbook-pro.tail6bf4dc.ts.net:8443/connect}" FLUTTER="${FLUTTER:-/Users/alan/development/flutter/bin/flutter}" export JAVA_HOME="${JAVA_HOME:-/Applications/Android Studio.app/Contents/jbr/Contents/Home}" export ANDROID_HOME="${ANDROID_HOME:-$HOME/Library/Android/sdk}" code=$(( $(date +%s) / 60 )) name="0.1.$code" "$FLUTTER" build apk --release --build-number="$code" --build-name="$name" \ --dart-define=PIPELINES_SERVER_URL="$server" \ --dart-define=PIPELINES_UPDATES_URL="${PIPELINES_UPDATES_URL:-https://alans-macbook-pro.tail6bf4dc.ts.net:8096/updates/}" mkdir -p build/updates cp build/app/outputs/flutter-apk/app-release.apk build/updates/pipelines.apk cat > build/updates/version.json <