#!/usr/bin/env bash # After tools/verify.sh passes: puts the household build in ~/Documents/OrbitTV/outputs// with a BUILD.txt that the # signing script (tools/sign-household.sh, copied to outputs/sign.sh) reads. Nothing is signed or installed here. # # bash tools/make-build-folder.sh 1.0-rc1 "What changed, in one line" set -euo pipefail NAME=${1:?a build name, such as 1.0-rc1} CHANGES=${2:?one line on what changed} ROOT=$(cd "$(dirname "$0")/.." && pwd) OUTPUTS=${ORBIT_OUTPUTS:-$HOME/Documents/OrbitTV/outputs} APK=$ROOT/android/app/build/outputs/apk/household/release/app-household-release-unsigned.apk [ -f "$APK" ] || { echo "No household release build: run tools/verify.sh first."; exit 1; } [ -z "$(git -C "$ROOT" status --porcelain -- android)" ] || { echo "android/ has uncommitted changes: commit first, so the build matches a commit."; exit 1; } BT=$(ls -d /opt/android-sdk/build-tools/* | sort -V | tail -1) DIR=$OUTPUTS/$NAME [ ! -e "$DIR" ] || { echo "$DIR already exists."; exit 1; } mkdir -p "$DIR" UNSIGNED=orbit-$NAME-aligned-unsigned.apk "$BT/zipalign" -f -p 4 "$APK" "$DIR/$UNSIGNED" BADGING=$("$BT/aapt2" dump badging "$DIR/$UNSIGNED" 2>/dev/null | grep -m1 "^package:" || true) VERSION=$(sed -E "s/.*versionName='([^']*)'.*/\1/" <<<"$BADGING"); CODE=$(sed -E "s/.*versionCode='([^']*)'.*/\1/" <<<"$BADGING") cat > "$DIR/BUILD.txt" <