-
-
Save oirodolfo/bedec67b31608d521c161a39c1209a54 to your computer and use it in GitHub Desktop.
Creates a signed and zipaligned APK from your Ionic project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
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 build v$version" | |
ionic build --release android | |
echo "" | |
echo "" | |
echo "---> Input the password for the key" | |
jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore $company.keystore 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/ | |
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" | |
open releases/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment