-
Notifications
You must be signed in to change notification settings - Fork 10
/
entrypoint.sh
executable file
·53 lines (40 loc) · 1.56 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
aab_path=$INPUT_AAB_PATH
keystore_path=$INPUT_KEYSTORE_PATH
keystore_password=$INPUT_KEYSTORE_PASSWORD
keystore_alias=$INPUT_KEYSTORE_ALIAS
keystore_alias_password=$INPUT_KEYSTORE_ALIAS_PASSWORD
if [ ! -f "$aab_path" ]; then
echo "aab file: \"$aab_path\" not found!"
exit 1
fi
if [ ! -f "$keystore_path" ]; then
echo "Keystore file: \"$keystore_path\" not found!"
exit 1
fi
if [ -z $keystore_password ] || [ -z $keystore_alias ] || [ -z $keystore_alias ]; then
echo "Keystore password, keystore alias or keystore alias password is empty!"
exit 1
fi
echo "Downloading Bundletool..."
bundletool="bundletool.jar"
bundletoolUrl="https://github.com/google/bundletool/releases/download/0.13.4/bundletool-all.jar"
exec wget -nv --quiet "${bundletoolUrl}" --output-document="${bundletool}" &
wait
if [ ! -f "$bundletool" ]; then
echo "Unable to download Bundletool!"
exit 1
fi
output_dir=$INPUT_OUTPUT_DIR
rm -rfv ${output_dir}
mkdir -p ${output_dir}
echo "Building universal APK. AAB file path: ${aab_path}"
apks_output="${output_dir}/apks.apks"
exec java -jar "${bundletool}" build-apks --bundle="${aab_path}" --output=${apks_output} --mode=universal --ks=${keystore_path} --ks-pass=pass:"${keystore_password}" --ks-key-alias="${keystore_alias}" --key-pass=pass:"${keystore_alias_password}" &
wait
echo "Unziping *.apks file: ${apks_output}"
exec unzip -qq ${apks_output} -d ${output_dir} &
wait
final_apk_path="${output_dir}/universal.apk"
echo "Universal APK file path: ${final_apk_path}"
echo UNIVERSAL_APK_PATH=${final_apk_path} >> $GITHUB_ENV