Skip to content

Instantly share code, notes, and snippets.

@bayerj
Forked from reklis/build.sh
Created September 30, 2011 15:43
Show Gist options
  • Save bayerj/1254157 to your computer and use it in GitHub Desktop.
Save bayerj/1254157 to your computer and use it in GitHub Desktop.
Archive post-action
asdasd#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment