Add release-build script; and bump version number to 0.5.0

This commit is contained in:
James Babcock committed 2026-08-22 22:28:36 -07:00
1 parent cc4b69fb80
commit 69ec828cb7
4 files changed
+94 -4

No files matched your search

+19 -3
View File
@@ -252,6 +252,22 @@ tasks.register("prepareFaceclawLlama") {
}
}
// versionName tracks FACECLAW_VERSION in app/version.ts, the single source of
// truth for the Faceclaw version. The gradle root project is platforms/android,
// so the repo root is two levels up from rootDir.
def faceclawVersionName = "0.0"
def faceclawVersionFile = file("$rootDir/../../app/version.ts")
if (faceclawVersionFile.exists()) {
def faceclawVersionMatch = (faceclawVersionFile.text =~ /FACECLAW_VERSION = "([^"]+)"/)
if (faceclawVersionMatch.find()) {
faceclawVersionName = faceclawVersionMatch.group(1)
}
}
def faceclawVersionCode = {
def parts = (faceclawVersionName.tokenize('.') + ["0", "0"]).take(3)*.toInteger()
return parts[0] * 10000 + parts[1] * 100 + parts[2]
}()
android {
compileSdkVersion 35
buildToolsVersion "35"
@@ -268,9 +284,9 @@ android {
abiFilters "arm64-v8a"
}
// Version Information
versionCode 1
versionName "1.0.0"
// Version Information (derived from app/version.ts above)
versionCode faceclawVersionCode
versionName faceclawVersionName
generatedDensities = []
}
+1 -1
View File
@@ -1,2 +1,2 @@
export const FACECLAW_VERSION = "0.4.1";
export const FACECLAW_VERSION = "0.5";
export const USER_AGENT = "Faceclaw/"+FACECLAW_VERSION;
+1
View File
@@ -5,6 +5,7 @@
"private": false,
"scripts": {
"build": "nativescript build android",
"release": "scripts/release.sh",
"clean": "rm -rf platforms"
},
"dependencies": {
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
# Build a signed release APK at dist/Faceclaw-<version>.apk, where <version>
# comes from FACECLAW_VERSION in app/version.ts.
#
# Prompts for the keystore passphrase. Override the keystore location with
# ANDROID_KEYSTORE=/path/to/store.jks.
#
# Note: the passphrase is passed to the nativescript CLI on its command line,
# so it is briefly visible in `ps` on this machine while the build runs.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
KEYSTORE="${ANDROID_KEYSTORE:-$HOME/repositories/AndroidKeystore/jimrandomh-android-keystore.jks}"
if [ ! -f "$KEYSTORE" ]; then
echo "Keystore not found: $KEYSTORE (set ANDROID_KEYSTORE to override)" >&2
exit 1
fi
# build.sh is the machine-specific wrapper that exports JAVA_HOME/ANDROID_HOME.
# Pick up its exports so keytool and the build use the same JDK.
if [ -f build.sh ]; then
eval "$(grep '^export ' build.sh)"
fi
if ! command -v keytool >/dev/null; then
echo "keytool not found; set JAVA_HOME (usually via build.sh)" >&2
exit 1
fi
VERSION="$(sed -n 's/^export const FACECLAW_VERSION = "\([^"]*\)".*/\1/p' app/version.ts)"
if [ -z "$VERSION" ]; then
echo "Could not read FACECLAW_VERSION from app/version.ts" >&2
exit 1
fi
read -r -s -p "Keystore passphrase for $(basename "$KEYSTORE"): " STORE_PASS
echo
# Validate the passphrase up front and discover the signing-key alias.
if ! LISTING="$(keytool -list -keystore "$KEYSTORE" -storepass "$STORE_PASS" 2>&1)"; then
printf '%s\n' "$LISTING" >&2
exit 1
fi
ALIAS="$(printf '%s\n' "$LISTING" | awk -F', ' '/PrivateKeyEntry/{print $1; exit}')"
if [ -z "$ALIAS" ]; then
echo "No private-key entry found in $KEYSTORE:" >&2
printf '%s\n' "$LISTING" >&2
exit 1
fi
echo "Signing as '$ALIAS', version $VERSION"
read -r -s -p "Key passphrase for '$ALIAS' (empty = same as keystore): " KEY_PASS
echo
KEY_PASS="${KEY_PASS:-$STORE_PASS}"
OUT="dist/Faceclaw-$VERSION.apk"
mkdir -p dist
rm -f "$OUT"
npx nativescript build android --release \
--key-store-path "$KEYSTORE" \
--key-store-password "$STORE_PASS" \
--key-store-alias "$ALIAS" \
--key-store-alias-password "$KEY_PASS" \
--copy-to "$OUT"
echo
echo "Built $OUT"
if [ -n "${ANDROID_HOME:-}" ] && [ -d "$ANDROID_HOME/build-tools" ]; then
APKSIGNER="$(printf '%s\n' "$ANDROID_HOME/build-tools"/*/apksigner | sort -V | tail -1)"
[ -x "$APKSIGNER" ] && "$APKSIGNER" verify --print-certs "$OUT" | head -5
fi