Skip to content

Instantly share code, notes, and snippets.

@sonsongithub
Created November 5, 2013 06:55
Show Gist options
  • Save sonsongithub/7314969 to your computer and use it in GitHub Desktop.
Save sonsongithub/7314969 to your computer and use it in GitHub Desktop.
TEAM_TOKEN="<TEAM TOKEN>"
API_TOKEN="<API TOKEN>"
DISTRIBUTION_LISTS="<Distribution list, that is separated by comma>"
/bin/mkdir -p ./tmp
DSYM="/tmp/Archive.xcarchive/dSYMs/${PRODUCT_NAME}.app.dSYM"
IPA="/tmp/Archive.xcarchive/${PRODUCT_NAME}.ipa"
APP="/tmp/Archive.xcarchive/Products/Applications/${PRODUCT_NAME}.app"
echo "Previous cache files."
/bin/rm -rf /tmp/Archive.xcarchive*
echo "Copy binary files."
/bin/cp -Rp "/Library/Server/Xcode/Data/BotRuns/Latest/output/Archive.xcarchive" "/tmp/"
echo "Zip dSYM directory to upload to TestFlight."
/bin/rm "${DSYM}.zip"
/usr/bin/zip -r "${DSYM}.zip" "${DSYM}"
echo "Sign the binary file with AdHoc provisioning."
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "${IPA}" --sign "<Sign title>" --embed "<Full path to provisioning file>"
echo "Get git commit log."
commitLog=`cd ${SRCROOT};git log -1 --pretty='%s';`
echo "Upload to TestFlight."
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=@"${IPA}" \
-F dsym=@"${DSYM}.zip" \
-F api_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F distribution_lists="${DISTRIBUTION_LISTS}" \
-F notes="${commitLog}"
echo "Finish all tasks."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment