Created
January 20, 2012 21:07
-
-
Save jamesdaniels/1649575 to your computer and use it in GitHub Desktop.
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 | |
# some variables we'll use later on | |
PROJECT_PATH=${WORKSPACE}/trunk | |
SIGNING_PATH=${PROJECT_PATH}/Signing | |
APP=Clock | |
XCODEPROJ_PATH="${PROJECT_PATH}/${APP}.xcodeproj" | |
XCODE_TARGET_NAME=${APP}.app | |
DSYM_NAME=${XCODE_TARGET_NAME}.dSYM | |
BUILD_PATH=${PROJECT_PATH}/build | |
P12_PATH=${SIGNING_PATH}/raizlabs.p12 | |
MOBILEPROVISION_PATH=${SIGNING_PATH}/raizlabs_adhoc.mobileprovision | |
BUILD_CONFIGURATION=Distribution | |
IDENTITY=iPhone\ Distribution:\ Raizlabs\ Corporation | |
SDK=iphoneos | |
TARGET_PATH="${BUILD_PATH}/${BUILD_CONFIGURATION}-${SDK}/${XCODE_TARGET_NAME}" | |
IPA_PATH="${BUILD_PATH}/${BUILD_CONFIGURATION}-${SDK}/${APP}-${BUILD_CONFIGURATION}.ipa" | |
DSYM_PATH="${BUILD_PATH}/${BUILD_CONFIGURATION}-${SDK}/${DSYM_NAME}" | |
ZIPPED_DSYM_PATH="${BUILD_PATH}/${BUILD_CONFIGURATION}-${SDK}/${DSYM_NAME}-${BUILD_CONFIGURATION}.zip" | |
#install the distribution certificate for this application, delete first incase of conflict | |
security delete-certificate $IDENTITY | |
security import $P12_PATH -k login.keychain -P "" | |
#install the provisioning profiles for this application | |
cp -f $MOBILEPROVISION_PATH ~/Library/MobileDevice/Provisioning\ Profiles/ | |
# clean all targets to be safe | |
xcodebuild -project $XCODEPROJ_PATH -alltargets clean | |
# build the enterprise dev, enterprise production, distribution dev and distribution production builds | |
xcodebuild -project $XCODEPROJ_PATH -configuration $BUILD_CONFIGURATION | |
# | |
# Package up the IPA files for all of the above builds. | |
# | |
cd $PROJECT_PATH | |
rm -r $BUILD_PATH/**/*.zip | |
rm -r $BUILD_PATH/**/*.ipa | |
# Package the target | |
xcrun -sdk $SDK PackageApplication -v $TARGET_PATH -o $IPA_PATH --sign "$IDENTITY" --embed $MOBILEPROVISION_PATH | |
# | |
# ZIP UP THE DSYM files so they can be archived. | |
# | |
zip $ZIPPED_DSYM_PATH -r $DSYM_PATH | |
TAGGED_RELEASE=`git show-ref --tags --dereference | grep \`git rev-parse HEAD\` | awk '$2 !~ /refs\/tags\/jenkins(.+)\^\{\}/ { print $2 }'` | |
if [ -n "$TAGGED_RELEASE" ] | |
then | |
# If there was an exact match, we are on a tagged release | |
GIT_TAG=`echo $TAGGED_RELEASE | tr "^{}" " " | tr "/refs/tags/" " " | awk -F" " '{print $1}'` | |
RELEASE_CHANGELOG=`git show -s --format=%n $GIT_TAG` | |
API_KEY=xxxxxxxxxxx | |
PROJECT_UUID=xxxxxxxxxx | |
curl -# -H "Accept: application/json" -H "Authorization: Bearer $API_KEY" -F "version[async_bundle]=@$IPA_PATH" -F "version[dsym]=@$ZIPPED_DSYM_PATH" -F "version[version_string]=\"$GIT_TAG\"" -F "version[changelog]=$RELEASE_CHANGELOG" https://appblade.com/api/projects/$PROJECT_UUID/versions | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment