[SKIP CI] Parallelize APK signing step

This commit is contained in:
arkon 2021-02-12 19:56:38 -05:00
parent 3836469f71
commit e4aac462c8
1 changed files with 17 additions and 6 deletions

View File

@ -24,18 +24,29 @@ export KEY_PASSWORD=$4
DEST=$PWD/apk DEST=$PWD/apk
rm -rf $DEST && mkdir -p $DEST rm -rf $DEST && mkdir -p $DEST
MAX_PARALLEL=4
# Sign all of the APKs # Sign all of the APKs
for APK in ${APKS[@]}; do for APK in ${APKS[@]}; do
BASENAME=$(basename $APK) (
APKNAME="${BASENAME%%+(-release*)}.apk" BASENAME=$(basename $APK)
APKDEST="$DEST/$APKNAME" APKNAME="${BASENAME%%+(-release*)}.apk"
APKDEST="$DEST/$APKNAME"
${TOOLS}/zipalign -c -v -p 4 $APK ${TOOLS}/zipalign -c -v -p 4 $APK
cp $APK $APKDEST cp $APK $APKDEST
${TOOLS}/apksigner sign --ks $STORE_PATH --ks-key-alias $STORE_ALIAS --ks-pass env:KEY_STORE_PASSWORD --key-pass env:KEY_PASSWORD $APKDEST ${TOOLS}/apksigner sign --ks $STORE_PATH --ks-key-alias $STORE_ALIAS --ks-pass env:KEY_STORE_PASSWORD --key-pass env:KEY_PASSWORD $APKDEST
) &
# Allow to execute up to $MAX_PARALLEL jobs in parallel
if [[ $(jobs -r -p | wc -l) -ge $MAX_PARALLEL ]]; then
wait -n
fi
done done
wait
rm $STORE_PATH rm $STORE_PATH
unset KEY_STORE_PASSWORD unset KEY_STORE_PASSWORD
unset KEY_PASSWORD unset KEY_PASSWORD