-
-
Save DnyaneshwarWagh/a4a649cb29789dc5d131f5ad4b41ebab to your computer and use it in GitHub Desktop.
My iOS IPA build script for XCode workspace with CocoaPods installed
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
#Code Sign | |
PRODUCT_NAME="MyApp" | |
WORKSPACE_NAME=$PRODUCT_NAME | |
SCHEME_NAME=$PRODUCT_NAME | |
DEVELOPER_NAME="iPhone Developer: XXXXXXXX (2CA66F8Y8L)" | |
PROVISONNING_PROFILE_DEBUG="profile/OOO.mobileprovision" | |
PROVISONNING_PROFILE_RELEASE="profile/XXXXX.mobileprovision" | |
# | |
BUILD_SDK="iphoneos" | |
BUILD_FOLDER="build" | |
DERIVEDDATA_FOLDER="derivedData" |
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/sh | |
# Created by : Ryan Wu hello@ryanwu.me | |
# MIT License : http://ryanwu.mit-license.org | |
# set -x | |
# | |
CONFIG=build.config | |
if [ ! -f $CONFIG ]; then | |
echo "Configuration File not found!" | |
exit 0 | |
fi | |
echo Importing Configuration | |
source $CONFIG | |
BUILD_NUMBER=`date +%m%d%H%M` | |
BUILD_DATE=`date +%m%d` | |
PROJ_DIR=`pwd` | |
DERIVEDDATA_PATH="${PROJ_DIR}/${DERIVEDDATA_FOLDER}" | |
BUILD_PATH="${PROJ_DIR}/${BUILD_FOLDER}" | |
function errorLeave { | |
echo "Command Usage :" | |
echo "\t > build.sh [ Debug | Release ] expected \n" | |
echo "Configuration File:" | |
echo "\t build.config" | |
exit 0 | |
} | |
if [ "$1" = "Debug" ];then | |
XCONF="Debug" | |
XPROFILE=$PROVISONNING_PROFILE_DEBUG | |
elif [ "$1" = "Release" ];then | |
XCONF="Release" | |
XPROFILE=$PROVISONNING_PROFILE_RELEASE | |
else | |
errorLeave | |
fi | |
# echo Updating CocoaPods | |
# pod install | |
[ -d $DERIVEDDATA_PATH ] || mkdir -p $DERIVEDDATA_PATH | |
[ -d $BUILD_PATH ] || mkdir -p $BUILD_PATH | |
echo Building Workspace | |
xcodebuild -workspace "${WORKSPACE_NAME}.xcworkspace" -scheme $SCHEME_NAME -derivedDataPath $DERIVEDDATA_PATH -configuration $XCONF | |
echo Verify Code Sign | |
codesign -d -vvv --file-list - "${DERIVEDDATA_PATH}/Build/Products/${XCONF}-${BUILD_SDK}/${PRODUCT_NAME}.app" | |
echo Packaging IPA | |
xcrun -l -sdk $BUILD_SDK PackageApplication -v "${DERIVEDDATA_PATH}/Build/Products/${XCONF}-${BUILD_SDK}/${PRODUCT_NAME}.app" -o "${BUILD_PATH}/${PRODUCT_NAME}-${XCONF}-${BUILD_NUMBER}.ipa" –sign $DEVELOPER_NAME –embed $XPROFILE | |
open build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment