Last active
August 29, 2015 13:56
-
-
Save hjazz/8927543 to your computer and use it in GitHub Desktop.
TestFlight Upload Archive Script (put this script Schema's Archive Post-actions)
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
# | |
# Terminal Notification! | |
# if you don't have terminal-notifier command line tool, | |
# >brew install terminal-notifier | |
# | |
API_TOKEN="API_TOKEN" | |
TEAM_TOKEN="TEAM_TOKEN" | |
SIGNING_IDENTITY="iPhone Distribution: ..." | |
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/...mobileprovision" | |
LOG="/tmp/testflight.log" | |
GROWL="/usr/local/bin/terminal-notifier -title Xcode -message" | |
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 | |
${GROWL} "Creating .ipa for ${PRODUCT_NAME}" | |
/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 | |
${GROWL} "Created .ipa for ${PRODUCT_NAME}" | |
#echo -n "Zipping .dSYM for ${PRODUCT_NAME}..." >> $LOG | |
${GROWL} "Zipping .dSYM for ${PRODUCT_NAME}" | |
/bin/rm "/tmp/${PRODUCT_NAME}.dSYM.zip" | |
/usr/bin/zip -r "/tmp/${PRODUCT_NAME}.dSYM.zip" "${DSYM}" | |
#echo "done." >> $LOG | |
${GROWL} "Created .dSYM for ${PRODUCT_NAME}" | |
#echo -n "Uploading to TestFlight... " >> $LOG | |
${GROWL} "Uploading to TestFlight" | |
/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." \ | |
-F notify="True" \ | |
-F distribution_lists="[lists]" | |
#echo "done." >> $LOG | |
${GROWL} "Uploaded to TestFlight" | |
/usr/bin/open "https://testflightapp.com/dashboard/builds/" |
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) | |
# | |
# Valid and working as of 10/29/2013 | |
# Xcode 5.0.1, XCode Server | |
# | |
API_TOKEN="API_TOKEN" | |
TEAM_TOKEN="TEAM_TOKEN" | |
DISTRIBUTION_LISTS="LIST_NAME" | |
PROVISIONING_PROFILE="PROVISIONING_PROFILE_PATH" | |
SIGNING_IDENTITY="CODE_SIGN_IDENTITY_NAME" | |
#EXAMPLE:"iPhone Distribution: Unwired Revolution, LLC." | |
# DO NOT EDIT BELOW HERE! | |
######################################## | |
DSYM="/tmp/Archive.xcarchive/dSYMs/${PRODUCT_NAME}.app.dSYM" | |
IPA="/tmp/${PRODUCT_NAME}.ipa" | |
APP="/tmp/Archive.xcarchive/Products/Applications/${PRODUCT_NAME}.app" | |
# Clear out any old copies of the Archive | |
echo "Removing old Archive files from /tmp..."; | |
/bin/rm -rf /tmp/Archive.xcarchive* | |
#Copy over the latest build the bot just created | |
echo "Copying latest Archive to /tmp/..."; | |
LATESTBUILD=$(ls -1rt /Library/Server/Xcode/Data/BotRuns | tail -1) | |
/bin/cp -Rp "/Library/Server/Xcode/Data/BotRuns/${LATESTBUILD}/output/Archive.xcarchive" "/tmp/" | |
echo "Creating .ipa for ${PRODUCT_NAME}" | |
/bin/rm "${IPA}" | |
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "${IPA}" --sign "${SIGNING_IDENTITY}" --embed "${PROVISIONING_PROFILE}" | |
echo "Done with IPA creation." | |
echo "Zipping .dSYM for ${PRODUCT_NAME}" | |
/bin/rm "${DSYM}.zip" | |
/usr/bin/zip -r "${DSYM}.zip" "${DSYM}" | |
echo "Created .dSYM for ${PRODUCT_NAME}" | |
echo "*** Uploading ${PRODUCT_NAME} to TestFlight ***" | |
/usr/bin/curl "http://testflightapp.com/api/builds.json" \ | |
-F file=@"${IPA}" \ | |
-F dsym=@"${DSYM}.zip" \ | |
-F notify="True" \ | |
-F api_token="${API_TOKEN}" \ | |
-F team_token="${TEAM_TOKEN}" \ | |
-F distribution_lists="${DISTRIBUTION_LISTS}" \ | |
-F notes="Build uploaded automatically from Xcode Server Bot." | |
echo "TestFlight upload finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment