-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
54 lines (44 loc) · 1.64 KB
/
release.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
#!/bin/bash
#
# Creates a signed and zipaligned APK from your Ionic project
#
# Place your keystore in the root of your project and name it <company>.keystore
# Use this script as following :
# $ ./release.sh [company] [version]
#
# Don't forget to gitignore your key and your compiled apks.
#
# Original at https://gist.github.com/th3m4ri0/acc2003adc7dffdbbad6
# Author : Erwan d'Orgeville<[email protected]>
# Abort if any command returns something else than 0
set -e
company="$1"
version="$2"
storepassword="$3"
appname_dirty=${PWD##*/}
appname=${appname_dirty//[^a-zA-Z]} # Keeps only a-z letters
if [[ -z "$1" ]]; then
echo "No company name provided, aborting..."
exit 1
fi
if [[ -z "$2" ]]; then
echo "No version provided, aborting..."
exit 1
fi
echo "---> Starting $appname build v$version"
echo "Company: $company"
/usr/bin/ionic build --release android
echo ""
echo ""
echo "---> Input the password for the key"
echo "Password: $storepassword"
/usr/bin/jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/tomcat/$company.keystore -storepass "$storepassword" platforms/android/build/outputs/apk/android-release-unsigned.apk $company
cp platforms/android/build/outputs/apk/android-release-unsigned.apk platforms/android/build/outputs/apk/com.$company.$appname.v$version-unaligned.apk
echo ""
echo ""
echo "---> Zipaligning"
mkdir -p releases/
/vol/tools/android-sdk-linux/build-tools/23.0.1/zipalign -v 4 platforms/android/build/outputs/apk/com.$company.$appname.v$version-unaligned.apk releases/com.$company.$appname.v$version.apk
echo ""
echo ""
echo "---> App released ! Look for com.$company.$appname.v$version.apk"