Add build automation and CI publishing workflow
Some checks failed
Android CI / build (push) Has been cancelled
Some checks failed
Android CI / build (push) Has been cancelled
This commit is contained in:
27
scripts/update_site_metadata.sh
Executable file
27
scripts/update_site_metadata.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_FILE="$ROOT_DIR/android/app/build.gradle.kts"
|
||||
META_DIR="$ROOT_DIR/website/assets/meta"
|
||||
APK_FILE="$ROOT_DIR/website/downloads/app-debug.apk"
|
||||
OUTPUT_FILE="$META_DIR/version.json"
|
||||
|
||||
mkdir -p "$META_DIR"
|
||||
|
||||
version_code="$(grep -E 'versionCode = [0-9]+' "$BUILD_FILE" | head -n1 | sed -E 's/.*versionCode = ([0-9]+)/\1/')"
|
||||
version_name="$(grep -E 'versionName = "[0-9]+\.[0-9]+\.[0-9]+"' "$BUILD_FILE" | head -n1 | sed -E 's/.*versionName = "([0-9]+\.[0-9]+\.[0-9]+)"/\1/')"
|
||||
build_date="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
||||
apk_size="$(stat -c %s "$APK_FILE")"
|
||||
|
||||
cat > "$OUTPUT_FILE" <<EOF
|
||||
{
|
||||
"versionName": "$version_name",
|
||||
"versionCode": $version_code,
|
||||
"buildDateUtc": "$build_date",
|
||||
"apkPath": "downloads/app-debug.apk",
|
||||
"apkSizeBytes": $apk_size
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Site metadata updated: $version_name ($version_code)"
|
||||
Reference in New Issue
Block a user