Last active
December 18, 2015 15:59
-
-
Save ealeksandrov/5808692 to your computer and use it in GitHub Desktop.
TestFlight autoupload 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 | |
# | |
# upload-testflight.sh | |
# | |
# Created by Justin Miller. Edited by Evgeny Aleksandrov. | |
API_TOKEN="APP_TOKEN_HERE" | |
TEAM_TOKEN="TEAM_TOKEN_HERE" | |
PROVISIONING_PROFILE_NAME="PROVISION_NAME_HERE" | |
# apple script notifier | |
notify () { | |
/usr/bin/osascript -e "display notification \"$1\" with title \"Xcode\"" | |
} | |
# 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 ) | |
ARCHIVE_PATH="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}" | |
DSYM="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/dSYMs/${PRODUCT_NAME}.app.dSYM" | |
notify "Creating .ipa for ${PRODUCT_NAME}" | |
/bin/rm "/tmp/${PRODUCT_NAME}.ipa" | |
# echo "Creating .ipa for ${PRODUCT_NAME}... " > $LOG | |
# echo "ARCHIVE_PATH: ${ARCHIVE_PATH} >> $LOG | |
# echo "PROVISIONING_PROFILE_NAME: ${PROVISIONING_PROFILE_NAME} >> $LOG | |
xcodebuild -exportArchive -archivePath "${ARCHIVE_PATH}" -exportPath "/tmp/${PRODUCT_NAME}.ipa" -exportFormat ipa -exportProvisioningProfile "${PROVISIONING_PROFILE_NAME}" | |
notify "Created .ipa for ${PRODUCT_NAME}" | |
notify "Zipping .dSYM for ${PRODUCT_NAME}" | |
/bin/rm "/tmp/${PRODUCT_NAME}.dSYM.zip" | |
/usr/bin/zip -r "/tmp/${PRODUCT_NAME}.dSYM.zip" "${DSYM}" | |
notify "Created .dSYM for ${PRODUCT_NAME}" | |
notify "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." | |
notify "Uploaded to TestFlight" | |
/usr/bin/open "https://testflightapp.com/dashboard/builds/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment