-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.sh
executable file
·58 lines (44 loc) · 1.26 KB
/
build.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
54
55
56
57
#!/bin/bash
set -e
GULP=1
SIGN=0
KEYSTORE_FILE=eff-alerts.keystore
KEYSTORE_ALIAS=
while [ $# -ne 0 ]; do
case $1 in
--no-gulp)
GULP=0
shift
;;
--sign)
SIGN=1
KEYSTORE_ALIAS=$2
shift 2
;;
--version)
code=$(echo "$2" | cut -d : -f 1)
version=$(echo "$2" | cut -d : -f 2)
sed -ri "s@versionCode=\"[^\"]+\"@versionCode=\"$code\"@" config.xml
sed -ri "s@org.eff.actioncenter..version=\"[^\"]+\"@org.eff.actioncenter\" version=\"$version\"@" config.xml
shift 2
;;
*)
echo "Usage: $0 [--no-gulp] [--sign alias]"
exit 1
;;
esac
done
if [ $GULP -eq 1 ]; then
cordova clean
npm install
NODE_ENV=production gulp build
fi
cordova build --release android
cp platforms/android/build/outputs/apk/release/android-release-unsigned.apk android-release-unsigned.apk
if [ $SIGN -eq 1 ]; then
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
-keystore "$KEYSTORE_FILE" \
android-release-unsigned.apk \
"$KEYSTORE_ALIAS"
fi
zipalign -f -v 4 android-release-unsigned.apk releases/android-release.apk