From 6f260bdfafcdc0ec1589109c4b87214cbe08072c Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Thu, 4 Jan 2024 15:17:05 +1300 Subject: [PATCH] CICD: Add APK Signing for the Android CICD Pipeline. Add signing of the android APK to the scripts used by the CICD pipeline. Also update the example for running these scripts locally, and add the artefacts generated by doing so to .gitignore. Signed-off-by: Michael Keller --- .gitignore | 6 +++++- packaging/android/.gitignore | 1 + packaging/android/qmake-build.sh | 27 +++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a7a77eb71..243b8aa55 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,10 @@ Subsurface.app build* nightly-builds/ mobile-widgets/qml/kirigami +mobile-widgets/3rdparty/ECM/ +mobile-widgets/3rdparty/breeze-icons/ +mobile-widgets/3rdparty/extra-cmake-modules/ +mobile-widgets/3rdparty/kirigami/ packaging/ios/install-root packaging/ios/Info.plist packaging/ios/Qt @@ -44,4 +48,4 @@ packaging/ios/asset_catalog_compiler.Info.plist appdata/subsurface.appdata.xml scripts/docker/android-build-container/android-build-setup.sh scripts/docker/android-build-container/variables.sh - +android-mobile/Roboto-Regular.ttf diff --git a/packaging/android/.gitignore b/packaging/android/.gitignore index d25632a41..ae79a7a1b 100644 --- a/packaging/android/.gitignore +++ b/packaging/android/.gitignore @@ -7,3 +7,4 @@ libzip-*/ libgit2-*/ ndk-*/ sqlite-autoconf-*/ +translation-assets/ diff --git a/packaging/android/qmake-build.sh b/packaging/android/qmake-build.sh index 229f3e0d2..d231c6090 100755 --- a/packaging/android/qmake-build.sh +++ b/packaging/android/qmake-build.sh @@ -402,6 +402,29 @@ fi # now build the Subsurface aab make apk -if [ -n "${OUTPUT_DIR+X}" ] ; then - mv $(find . -name Subsurface-mobile.apk) "$OUTPUT_DIR"/Subsurface-mobile-"$CANONICALVERSION".apk +popd + +APK=$(find . -name Subsurface-mobile.apk) +APK_DIR=$(dirname ${APK}) +APK_FILE=$(basename ${APK}) + +pushd ${APK_DIR} +if [ -n "${KEYSTORE_STRING+X}" ] ; then + # Generate the string to be supplied to the script with 'openssl base64 < subsurface.keystore | tr -d '\n'' + set +x + echo ${KEYSTORE_STRING} | base64 -di > /tmp/subsurface.keystore + set -x + + zip -d ${APK_FILE} 'META-INF/*.SF' 'META-INF/*.RSA' + ${BUILDROOT}/build-tools/29.0.3/zipalign -p 4 ${APK_FILE} $(basename ${APK_FILE} .apk)-aligned.apk + ${BUILDROOT}/build-tools/29.0.3/apksigner sign -ks /tmp/subsurface.keystore -ks-pass pass:nopass -in $(basename ${APK_FILE} .apk)-aligned.apk -out Subsurface-mobile-"${CANONICALVERSION}".apk + + rm /tmp/subsurface.keystore +else + mv ${APK_FILE} Subsurface-mobile-"${CANONICALVERSION}".apk fi + +if [ -n "${OUTPUT_DIR+X}" ] ; then + mv Subsurface-mobile-"${CANONICALVERSION}".apk "${OUTPUT_DIR}"/ +fi +popd