Skip to content

Instantly share code, notes, and snippets.

@dav
Created June 1, 2013 14:46
Show Gist options
  • Save dav/5690652 to your computer and use it in GitHub Desktop.
Save dav/5690652 to your computer and use it in GitHub Desktop.
iOS build script that uploads to testflight and crittercism
set -e
# env vars to set outside of SCM:
#
# Testflight:
# TEAM_TOKEN
# API_TOKEN
#
# CRITTERCISM_KEY
# CRITTERCISM_SECRET
PRODUCT_NAME=Twine
SCHEME=Twine
CONFIGURATION_BUILD_DIR=/Users/enterprise/${PRODUCT_NAME}AdHocBuild
# build app
xcodebuild -workspace iphone/Meexo.xcodeproj/project.xcworkspace -scheme ${SCHEME} -configuration "Ad-Hoc" CONFIGURATION_BUILD_DIR=${CONFIGURATION_BUILD_DIR}
# create IPA
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}.app" -o "${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}.ipa" --sign "Meexo, Inc." --embed "/Users/enterprise/Library/MobileDevice/Provisioning Profiles/CAA0FC83-3ABD-449A-85A8-E62F46C9E4C3.mobileprovision"
# create zipped dSYM
cd $CONFIGURATION_BUILD_DIR
ZIPPED_DSYM=${PRODUCT_NAME}.app.dSYM.zip
if [ -e $ZIPPED_DSYM ]; then
/bin/rm $ZIPPED_DSYM
fi
zip -r $ZIPPED_DSYM ${PRODUCT_NAME}.app.dSYM
#ditto -c -k --sequesterRsrc --keepParent ${PRODUCT_NAME}.app.dSYM $ZIPPED_DSYM # another way to zip
echo
echo "*** Built ${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}.ipa"
echo
echo "*******************"
echo " Upload to TestFlight: ${PRODUCT_NAME}"
echo "*******************"
if [ ! -z "$1" ]; then
MESSAGE=$1
else
MESSAGE="Build uploaded automatically."
fi
echo $MESSAGE
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=@"${PRODUCT_NAME}.ipa" \
-F dsym=@"${ZIPPED_DSYM}" \
-F api_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F distribution_lists="Meexo Dev" \
-F notes="$MESSAGE"
echo "*******************"
echo " Upload to Crittercism: ${ZIPPED_DSYM}"
echo "*******************"
#upload dSYM to Crittercism
echo curl "https://www.crittercism.com/api_beta/dsym/4fba4dcc38e56037cb000002" -F dsym=@"$CONFIGURATION_BUILD_DIR/$ZIPPED_DSYM" -F key=$CRITTERCISM_KEY -F secret=$CRITTERCISM_SECRET
curl "https://www.crittercism.com/api_beta/dsym/4fba4dcc38e56037cb000002" -F dsym=@"$ZIPPED_DSYM" -F key=$CRITTERCISM_KEY -F secret=$CRITTERCISM_SECRET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment