Created
September 1, 2011 19:12
-
-
Save incanus/1186990 to your computer and use it in GitHub Desktop.
Xcode 4 scheme Archive step Post-script for automatic TestFlight build uploading. See the blog post here: http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode
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 | |
# | |
# (Above line comes out when placing in Xcode scheme) | |
# | |
API_TOKEN=<TestFlight API token here> | |
TEAM_TOKEN=<TestFlight team token here> | |
SIGNING_IDENTITY="iPhone Distribution: Development Seed" | |
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision" | |
#LOG="/tmp/testflight.log" | |
GROWL="${HOME}/bin/growlnotify -a Xcode -w" | |
DATE=$( /bin/date +"%Y-%m-%d" ) | |
ARCHIVE=$( /bin/ls -t "${HOME}/Library/Developer/Xcode/Archives/${DATE}" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p ) | |
DSYM="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/dSYMs/${PRODUCT_NAME}.app.dSYM" | |
APP="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app" | |
#/usr/bin/open -a /Applications/Utilities/Console.app $LOG | |
#echo -n "Creating .ipa for ${PRODUCT_NAME}... " > $LOG | |
echo "Creating .ipa for ${PRODUCT_NAME}" | ${GROWL} | |
/bin/rm "/tmp/${PRODUCT_NAME}.ipa" | |
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "/tmp/${PRODUCT_NAME}.ipa" --sign "${SIGNING_IDENTITY}" --embed "${PROVISIONING_PROFILE}" | |
#echo "done." >> $LOG | |
echo "Created .ipa for ${PRODUCT_NAME}" | ${GROWL} | |
#echo -n "Zipping .dSYM for ${PRODUCT_NAME}..." >> $LOG | |
echo "Zipping .dSYM for ${PRODUCT_NAME}" | ${GROWL} | |
/bin/rm "/tmp/${PRODUCT_NAME}.dSYM.zip" | |
/usr/bin/zip -r "/tmp/${PRODUCT_NAME}.dSYM.zip" "${DSYM}" | |
#echo "done." >> $LOG | |
echo "Created .dSYM for ${PRODUCT_NAME}" | ${GROWL} | |
#echo -n "Uploading to TestFlight... " >> $LOG | |
echo "Uploading to TestFlight" | ${GROWL} | |
/usr/bin/curl "http://testflightapp.com/api/builds.json" \ | |
-F file=@"/tmp/${PRODUCT_NAME}.ipa" \ | |
-F dsym=@"/tmp/${PRODUCT_NAME}.dSYM.zip" \ | |
-F api_token="${API_TOKEN}" \ | |
-F team_token="${TEAM_TOKEN}" \ | |
-F notes="Build uploaded automatically from Xcode." | |
#echo "done." >> $LOG | |
echo "Uploaded to TestFlight" | ${GROWL} -s && /usr/bin/open "https://testflightapp.com/dashboard/builds/" |
Here's a link to a similar script, that works via Bots (bot not locally):
https://devforums.apple.com/message/905330
Works like a charm. Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been using this script, and it works great.
Now I've upgraded to Xcode 5 and Xcode Server (Mavericks). No problem there. But when I archive the scheme via a Bot on the server, the script fails because the intermediate products are located in a different location.
I'm curious if there's a way to refactor the script to accomodate running in both the desktop and the server environments.
Here're some of the logs from around the time the script is running: