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 <github@ike.ch>
This commit is contained in:
Michael Keller 2024-01-04 15:17:05 +13:00
parent d066241ad8
commit 6f260bdfaf
3 changed files with 31 additions and 3 deletions

6
.gitignore vendored
View file

@ -37,6 +37,10 @@ Subsurface.app
build* build*
nightly-builds/ nightly-builds/
mobile-widgets/qml/kirigami 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/install-root
packaging/ios/Info.plist packaging/ios/Info.plist
packaging/ios/Qt packaging/ios/Qt
@ -44,4 +48,4 @@ packaging/ios/asset_catalog_compiler.Info.plist
appdata/subsurface.appdata.xml appdata/subsurface.appdata.xml
scripts/docker/android-build-container/android-build-setup.sh scripts/docker/android-build-container/android-build-setup.sh
scripts/docker/android-build-container/variables.sh scripts/docker/android-build-container/variables.sh
android-mobile/Roboto-Regular.ttf

View file

@ -7,3 +7,4 @@ libzip-*/
libgit2-*/ libgit2-*/
ndk-*/ ndk-*/
sqlite-autoconf-*/ sqlite-autoconf-*/
translation-assets/

View file

@ -402,6 +402,29 @@ fi
# now build the Subsurface aab # now build the Subsurface aab
make apk make apk
if [ -n "${OUTPUT_DIR+X}" ] ; then popd
mv $(find . -name Subsurface-mobile.apk) "$OUTPUT_DIR"/Subsurface-mobile-"$CANONICALVERSION".apk
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 fi
if [ -n "${OUTPUT_DIR+X}" ] ; then
mv Subsurface-mobile-"${CANONICALVERSION}".apk "${OUTPUT_DIR}"/
fi
popd