Created
August 1, 2012 16:56
-
-
Save twolights/3228707 to your computer and use it in GitHub Desktop.
TestFlight upload automation script
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 | |
| # Modified from the script by Justin Miller | |
| # Source: http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode/ | |
| API_TOKEN='<YOUR TESTFLIGHT API TOKEN>' | |
| TEAM_TOKEN='<YOUR TESTFLIGHT TEAM TOKEN>' | |
| SIGNING_IDENTITY='<YOUR SIGNING IDENTITY>' | |
| PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/<NAME-OF-YOUR-PROVISIONING-PROFILE>" | |
| DATE=`/bin/date +'%Y-%m-%d'` | |
| ARCHIVE_PATH="$HOME/Library/Developer/Xcode/Archives/$DATE" | |
| ARCHIVE=`/bin/ls -t "$ARCHIVE_PATH" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p` | |
| DSYM="$ARCHIVE_PATH/$ARCHIVE/dSYMs/$PRODUCT_NAME.app.dSYM" | |
| APP="$ARCHIVE_PATH/$ARCHIVE/Products/Applications/$PRODUCT_NAME.app" | |
| IPA_OUTPUT="/tmp/$PRODUCT_NAME.ipa" | |
| DSYM_OUTPUT="/tmp/${PRODUCT_NAME}.dSYM.zip" | |
| JSON_OUTPUT=`mktemp "/tmp/$PRODUCT_NAME.json.XXXXXX"` | |
| # terminal-notifier: https://github.com/alloy/terminal-notifier | |
| TERMINAL_NOTIFIER="$HOME/.rvm/gems/ruby-1.9.2-p290/bin/terminal-notifier" | |
| function post_notification { | |
| $TERMINAL_NOTIFIER -message "$1" -title 'TestFlight Auto-upload' > /dev/null | |
| } | |
| /usr/bin/xcrun -sdk iphoneos PackageApplication "$APP" -o "$IPA_OUTPUT" --sign "$SIGNING_IDENTITY" --embed "$PROVISIONING_PROFILE" | |
| post_notification "$PRODUCT_NAME.ipa created" | |
| /bin/rm -f "$DSYM_OUTPUT" | |
| /usr/bin/zip -r -q "$DSYM_OUTPUT" "$DSYM" | |
| post_notification "$PRODUCT_NAME.dSYM zipped" | |
| post_notification "Uploading $PRODUCT_NAME to TestFlight..." | |
| /usr/bin/curl 'http://testflightapp.com/api/builds.json' \ | |
| -s -o $JSON_OUTPUT \ | |
| -F file=@"$IPA_OUTPUT" \ | |
| -F dsym=@"$DSYM_OUTPUT" \ | |
| -F api_token="$API_TOKEN" \ | |
| -F team_token="$TEAM_TOKEN" \ | |
| -F notes="Automatically uploaded build of '$PRODUCT_NAME'" | |
| post_notification "$PRODUCT_NAME is successfully uploaded to TestFlight" | |
| /usr/bin/open $( /usr/bin/grep config_url "$JSON_OUTPUT" | /usr/bin/cut -d \" -f 4 ) | |
| /bin/rm -f $JSON_OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment