Last active
August 29, 2015 14:05
-
-
Save yeco/94f0bac0b8438d9ea17f to your computer and use it in GitHub Desktop.
Build scripts for cordova app
This file contains hidden or 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 | |
TARGET=$1 | |
ANDROID_BUILD_PATH='platforms/android/ant-build/' | |
IOS_BUILD_PATH='platforms/ios/build/emulator/' | |
ANDROID_RELEASE_PATH='bin/android/' | |
IOS_RELEASE_PATH='bin/ios/' | |
PROJECT_NAME='senchaBPApp' | |
clean_deploy () | |
{ | |
BIN_PATH='cordova/bin' | |
if [[ $1 == 'android' ]]; then | |
BIN_PATH='cordova/bin/android' | |
elif [[ $1 == 'ios' ]]; then | |
BIN_PATH='cordova/bin/ios' | |
fi | |
rm -rf $BIN_PATH | |
mkdir -p $BIN_PATH | |
} | |
deploy_android () | |
{ | |
echo "[INFO] Building Android" | |
cd cordova | |
cordova build android --release | |
APP_NAME="$PROJECT_NAME-release.apk" | |
mv $ANDROID_BUILD_PATH$APP_NAME $ANDROID_RELEASE_PATH$APP_NAME | |
open $ANDROID_RELEASE_PATH | |
cd .. | |
echo "[INFO] Android release done" | |
} | |
deploy_ios () | |
{ | |
echo "[INFO] Building IOS" | |
cd cordova | |
sudo xcrun -sdk iphoneos PackageApplication "$IOS_BUILD_PATH$PROJECT_NAME.app" -o "$(pwd)/$IOS_RELEASE_PATH$PROJECT_NAME.ipa" | |
# // Enable this for signing | |
# --sign "Noter key name" \ | |
# --embed "NoterProvisioningProfile.mobileprovision" | |
open $IOS_RELEASE_PATH | |
cd .. | |
echo "[INFO] IOS release done" | |
} | |
if [[ $TARGET == 'android' ]]; then | |
clean_deploy android | |
deploy_android | |
elif [[ $TARGET == 'ios' ]]; then | |
clean_deploy ios | |
deploy_ios | |
else | |
deploy_ios | |
deploy_android | |
fi |
This file contains hidden or 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 | |
#<project>/generate_keystore.sh | |
cd ./cordova/platforms/android | |
ALIAS=noter | |
KEYSTORE=$ALIAS-release.keystore | |
keytool -genkey -v -keystore $KEYSTORE -alias $ALIAS -keyalg RSA -keysize 2048 -validity 10000 | |
touch ant.properties | |
echo "key.store=$KEYSTORE" >> ant.properties | |
echo "key.alias=$ALIAS" >> ant.properties | |
cd ../../../ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment