Skip to content

Instantly share code, notes, and snippets.

@reklis
Created September 30, 2011 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reklis/1254152 to your computer and use it in GitHub Desktop.
Save reklis/1254152 to your computer and use it in GitHub Desktop.
Archive post-action
#in older versions of Xcode4 you may need to set PRODUCT_NAME manually
DIST_LIST=<TestFlight Distribution List name here>
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 )
APP="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app"
NOTES=$(osascript ${HOME}/.utility_scripts/prompt.scpt 'Xcode' 'Enter TestFlight build Notes')
/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="${NOTES}" \
-F notify=True -F distribution_lists="${DIST_LIST}" >> $LOG
echo "done." >> $LOG
/usr/bin/open "https://testflightapp.com/dashboard/builds/"
on run argv
tell application (item 1 of argv)
set input to display dialog "" & item 2 of argv & ":" default answer ""
if button returned of input is equal to "OK" then
try
return (text returned of input)
end try
end if
end tell
@reklis
Copy link
Author

reklis commented Sep 30, 2011

original article:

http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode/

This is updated to prompt for notes and log the CURL result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment