qt-android/qt-build
Dorian Zedler a69a010c7b
All checks were successful
continuous-integration/drone/tag Build is passing
Feat: Allow to provide the keystore file as base64 encoded string
2022-08-04 18:36:47 +02:00

55 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
set -e
[[ -z "${PLUGIN_QMAKE_ARGUMENTS}" ]] && QMAKE_ARGUMENTS="" || QMAKE_ARGUMENTS="${PLUGIN_QMAKE_ARGUMENTS}"
[[ -z "${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}" ]] && ANDROIDDEPLOYQT_ARGUMENTS="" || ANDROIDDEPLOYQT_ARGUMENTS="${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}"
[[ -z "${PLUGIN_SRC_DIR}" ]] && SRC_DIR=$(pwd) || SRC_DIR=$(realpath "${PLUGIN_SRC_DIR}")
[[ -z "${PLUGIN_ANDROID_KEYSTORE_PATH}" ]] && ANDROID_KEYSTORE_PATH="" || ANDROID_KEYSTORE_PATH=$(realpath "${PLUGIN_ANDROID_KEYSTORE_PATH}")
[[ -z "${PLUGIN_ANDROID_KEYSTORE_DATA}" ]] && ANDROID_KEYSTORE_DATA="" || ANDROID_KEYSTORE_DATA="${PLUGIN_ANDROID_KEYSTORE_DATA}"
[[ -z "${PLUGIN_ANDROID_KEYSTORE_ALIAS}" ]] && ANDROID_KEYSTORE_ALIAS="" || ANDROID_KEYSTORE_ALIAS="${PLUGIN_ANDROID_KEYSTORE_ALIAS}"
[[ -z "${PLUGIN_ANDROID_KEYSTORE_STORE_PASS}" ]] && ANDROID_KEYSTORE_STORE_PASS="" || ANDROID_KEYSTORE_STORE_PASS="${PLUGIN_ANDROID_KEYSTORE_STORE_PASS}"
echo "**** prepare ****"
rm -rf /build
mkdir -p /build
cd /build
echo ""
echo "**** environment: ****"
echo "* QMAKE_ARGUMENTS=${QMAKE_ARGUMENTS}"
echo "* ANDROIDDEPLOYQT_ARGUMENTS=${ANDROIDDEPLOYQT_ARGUMENTS}"
echo "* SRC_DIR=${SRC_DIR}"
# handle signing stuff
if ( [ -n "$ANDROID_KEYSTORE_DATA" ] || [ -n "$ANDROID_KEYSTORE_PATH" ] ) && [ -n "$ANDROID_KEYSTORE_ALIAS" ]; then
if [ -n "$ANDROID_KEYSTORE_DATA" ]; then
echo $ANDROID_KEYSTORE_DATA | tr ' ' '\n' | base64 -d > /build/android_release.keystore
ANDROID_KEYSTORE_PATH=/build/android_release.keystore
echo "* SIGNING with keystore from provided data"
else
echo "* SIGNING with keystore $ANDROID_KEYSTORE_PATH"
fi
ANDROIDDEPLOYQT_ARGUMENTS="$ANDROIDDEPLOYQT_ARGUMENTS --sign $ANDROID_KEYSTORE_PATH $ANDROID_KEYSTORE_ALIAS"
if [ -n "$ANDROID_KEYSTORE_STORE_PASS" ]; then
ANDROIDDEPLOYQT_ARGUMENTS="$ANDROIDDEPLOYQT_ARGUMENTS --storepass $ANDROID_KEYSTORE_STORE_PASS"
fi
else
echo "* NO signing"
fi
echo "**********************"
echo ""
echo "**** qmake ****"
qmake $QMAKE_ARGUMENTS $SRC_DIR
echo "**** build native code ****"
make -j8
make INSTALL_ROOT=/build/android-build install
echo "**** android build ****"
androiddeployqt --input $(ls -1 /build/android-*-deployment-settings.json) --output /build/android-build $ANDROIDDEPLOYQT_ARGUMENTS
echo "**** finish up ****"
mv /build/android-build//build/outputs $SRC_DIR/outputs