diff --git a/.gitignore b/.gitignore index 6199707..83dc146 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ UserInterfaceState.xcuserstate out *.apk .env* -dist/ \ No newline at end of file +dist/ +*.aab \ No newline at end of file diff --git a/scripts/android-build.sh b/scripts/android-build.sh index d0a6223..ae1330e 100755 --- a/scripts/android-build.sh +++ b/scripts/android-build.sh @@ -4,8 +4,11 @@ set -e source .env UNSIGNED_APK="platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk" +UNSIGNED_AAB="platforms/android/app/build/outputs/bundle/release/app.aab" VERSION=`node -pe "require('./package.json').version"` -RELEASE_FILE=saza-v$VERSION.apk +RELEASE_VERSION=saza-v$VERSION +AAB_RELEASE_FILE=$RELEASE_VERSION.aab +APK_RELEASE_FILE=$RELEASE_VERSION.apk [[ -z "$SAZA_KEYSTORE" ]] && { echo "Error: SAZA_KEYSTORE not found"; exit 1; } @@ -16,11 +19,29 @@ RELEASE_FILE=saza-v$VERSION.apk echo "Building production release ..." ionic cordova build android --prod --release -echo "Signing apk ..." -jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_APK $SAZA_KEYSTORE_ALIAS +echo "Build android app bundle aab ... " +cd platforms/android/ +./gradlew bundle -echo "Run zipalign on apk ..." -~/Android/Sdk/build-tools/29.0.3/zipalign -f -v 4 $UNSIGNED_APK $RELEASE_FILE +cd ../.. + +if [[ "$SIGN_SAZA_RELEASE" = "false" ]] +then + echo "Not signing release ..." + cp $UNSIGNED_APK $APK_RELEASE_FILE +else + echo "Signing apk ..." + jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_APK $SAZA_KEYSTORE_ALIAS + + echo "Signing aab ..." + jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_AAB $SAZA_KEYSTORE_ALIAS + + echo "Run zipalign on apk ..." + ~/Android/Sdk/build-tools/29.0.3/zipalign -f -v 4 $UNSIGNED_APK $APK_RELEASE_FILE +fi + + +cp $UNSIGNED_AAB $AAB_RELEASE_FILE echo "Android production build completed..." -ls -alh $RELEASE_FILE \ No newline at end of file +ls -alh $RELEASE_VERSION* \ No newline at end of file