BlueWallet/scripts/build-release-apk.sh

29 lines
1.2 KiB
Bash
Raw Normal View History

2022-04-29 23:49:13 +02:00
#!/bin/bash
# assumes 2 env variables: KEYSTORE_FILE_HEX & KEYSTORE_PASSWORD
2024-02-04 01:23:00 +01:00
2022-04-29 23:49:13 +02:00
# PS. to turn file to hex and back:
# $ xxd -plain test.txt > test.hex
# $ xxd -plain -revert test.hex test2.txt
echo $KEYSTORE_FILE_HEX > bluewallet-release-key.keystore.hex
xxd -plain -revert bluewallet-release-key.keystore.hex > ./android/bluewallet-release-key.keystore
rm bluewallet-release-key.keystore.hex
cd android
2024-02-04 01:23:00 +01:00
# Use the BUILD_NUMBER environment variable set in the GitHub Actions workflow
sed -i'.original' "s/versionCode 1/versionCode $BUILD_NUMBER/g" app/build.gradle
2024-02-04 14:05:18 +01:00
# Extract versionName from build.gradle
VERSION_NAME=$(grep versionName app/build.gradle | awk '{print $2}' | tr -d '"')
2022-04-29 23:49:13 +02:00
./gradlew assembleRelease
2024-02-04 14:05:18 +01:00
# Rename the APK file to include the dynamic version and build number with parentheses
mv ./app/build/outputs/apk/release/app-release-unsigned.apk "./app/build/outputs/apk/release/BlueWallet-${VERSION_NAME}($BUILD_NUMBER).apk"
2024-01-14 00:17:25 +01:00
echo wheres waldo?
find $ANDROID_HOME | grep apksigner | grep -v jar
2024-02-04 14:05:18 +01:00
$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks ./bluewallet-release-key.keystore --ks-pass=pass:$KEYSTORE_PASSWORD "./app/build/outputs/apk/release/BlueWallet-${VERSION_NAME}($BUILD_NUMBER).apk"