Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save macteo/1226096 to your computer and use it in GitHub Desktop.
Save macteo/1226096 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
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"
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 )
ARCHIVE=$( /bin/ls -t "${HOME}/Sviluppo/Archives/${DATE}" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p )
// APP="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app"
APP="${HOME}/Sviluppo/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
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "/tmp/${PRODUCT_NAME}.ipa" --sign "${SIGNING_IDENTITY}" --embed "${PROVISIONING_PROFILE}"
echo "done." >> $LOG
echo -n "Uploading to TestFlight... " >> $LOG
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=@"/tmp/${PRODUCT_NAME}.ipa" \
-F api_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F notes="Build uploaded automatically from Xcode." \
-F notify=False
echo "done." >> $LOG
/usr/bin/open "https://testflightapp.com/dashboard/builds/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment