From 135b645b3d666f541d5955aaa82af4c480643fde Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 31 Oct 2023 20:43:01 -0400 Subject: [PATCH] ci: android: Use signing key if available Lets gradle handle apk signing when available --- .ci/scripts/android/build.sh | 9 +++++++++ .ci/scripts/android/upload.sh | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.ci/scripts/android/build.sh b/.ci/scripts/android/build.sh index a5fd1ee18..d135af029 100755 --- a/.ci/scripts/android/build.sh +++ b/.ci/scripts/android/build.sh @@ -8,8 +8,17 @@ ccache -s BUILD_FLAVOR=mainline +if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then + export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks" + base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}" +fi + cd src/android chmod +x ./gradlew ./gradlew "assemble${BUILD_FLAVOR}Release" "bundle${BUILD_FLAVOR}Release" ccache -s + +if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then + rm "${ANDROID_KEYSTORE_FILE}" +fi diff --git a/.ci/scripts/android/upload.sh b/.ci/scripts/android/upload.sh index cfaeff328..5f8ca73c0 100755 --- a/.ci/scripts/android/upload.sh +++ b/.ci/scripts/android/upload.sh @@ -13,15 +13,3 @@ cp src/android/app/build/outputs/apk/"${BUILD_FLAVOR}/release/app-${BUILD_FLAVOR "artifacts/${REV_NAME}.apk" cp src/android/app/build/outputs/bundle/"${BUILD_FLAVOR}Release"/"app-${BUILD_FLAVOR}-release.aab" \ "artifacts/${REV_NAME}.aab" - -if [ -n "${ANDROID_KEYSTORE_B64}" ] -then - echo "Signing apk..." - base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > ks.jks - - apksigner sign --ks ks.jks \ - --ks-key-alias "${ANDROID_KEY_ALIAS}" \ - --ks-pass env:ANDROID_KEYSTORE_PASS "artifacts/${REV_NAME}.apk" -else - echo "No keystore specified, not signing the APK files." -fi