-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release.sh
More file actions
executable file
·54 lines (42 loc) · 1.25 KB
/
Copy pathbuild-release.sh
File metadata and controls
executable file
·54 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Script to build and sign release APK for Yarrand
# Requires keystore credentials via environment variables or prompts
set -e
KEYSTORE_FILE="keystore.jks"
VERSION_FILE="app/build.gradle.kts"
# Get version from gradle file
VERSION=$(grep -oP 'versionName = "\K[^"]+' "$VERSION_FILE")
echo "Building Yarrand v${VERSION} (Release)"
echo "=========================================="
# Check if keystore exists
if [ ! -f "$KEYSTORE_FILE" ]; then
echo "Error: $KEYSTORE_FILE not found"
exit 1
fi
# Get keystore password
if [ -z "$KEYSTORE_PASSWORD" ]; then
read -sp "Enter keystore password: " KEYSTORE_PASSWORD
echo
fi
# Get key password
if [ -z "$KEY_PASSWORD" ]; then
read -sp "Enter key password: " KEY_PASSWORD
echo
fi
# Build release APK
export KEYSTORE_PASSWORD
export KEY_PASSWORD
echo "Compiling release APK..."
./gradlew clean assembleRelease
# Find and rename the generated APK
APK_PATH="app/build/outputs/apk/release/app-release.apk"
if [ -f "$APK_PATH" ]; then
APK_NAME="yarrand-v${VERSION}.apk"
cp "$APK_PATH" "$APK_NAME"
echo "✓ APK built and renamed to: $APK_NAME"
echo "✓ APK size: $(du -h "$APK_NAME" | cut -f1)"
else
echo "Error: APK not found at $APK_PATH"
exit 1
fi
echo "✓ Done!"