-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
build-apk.sh
32 lines (25 loc) · 850 Bytes
/
build-apk.sh
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
#!/bin/bash
function err_and_exit()
{
echo "$1" >&2
exit 1
}
function getVersionName()
{
echo $(grep versionName ./app/build.gradle.kts | awk -F '"' '{print $2}')
}
cat > ./keystore.properties <<EOF
storePassword=$ANDROID_STORE_PASSWORD
keyPassword=$ANDROID_KEY_PASSWORD
keyAlias=plain
storeFile=release.jks
EOF
cat > ./local.properties <<EOF
sdk.dir=/Users/$USER/Library/Android/sdk
EOF
./gradlew assembleGithubRelease || err_and_exit "build failed"
./gradlew assembleChinaRelease || err_and_exit "build failed"
BUILD_FILE="PlainApp-$(getVersionName).apk"
mv ./app/build/outputs/apk/github/release/app-github-release.apk ./app/build/outputs/apk/github/release/$BUILD_FILE
BUILD_FILE="PlainApp-$(getVersionName)-china.apk"
mv ./app/build/outputs/apk/china/release/app-china-release.apk ./app/build/outputs/apk/china/release/$BUILD_FILE