Forked from justinokamoto/gist:9bbe8837081e1aa88041
Created
November 7, 2015 11:16
-
-
Save NSCabezon/2abffcdfc051ab42c7fc to your computer and use it in GitHub Desktop.
Script for deploying iOS app to TestFlight with Xcode 6.1 & Xcode Server 4
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 11/4/2014 | |
# Xcode 6.1, XCode Server 4 | |
# | |
API_TOKEN="<Your TestFlight API Token>" | |
TEAM_TOKEN="<Your TestFlight Team Token>" | |
DISTRIBUTION_LISTS="<Comma separated TestFlight Distribution List Names for auto deploy>" | |
PROVISIONING_PROFILE="/Library/Developer/XcodeServer/ProvisioningProfiles/<your file name here>.mobileprovision" | |
SIGNING_IDENTITY="<your provisioning profile name here>" | |
# EXAMPLE: "iPhone Distribution: Company, Inc." | |
# DO NOT EDIT BELOW HERE! | |
######################################## | |
DSYM="${ARCHIVE_DSYMS_PATH}/${PRODUCT_NAME}.app.dSYM" | |
IPA="/tmp/${PRODUCT_NAME}.ipa" | |
APP="/tmp/Archive.xcarchive/Products/Applications/${PRODUCT_NAME}.app" | |
# Remove previous archive files from tmp folder | |
echo "Removing old Archive files from /tmp..."; | |
/bin/rm -rf /tmp/Archive.xcarchive* | |
# Copy over the latest archive to tmp folder | |
echo "Copying latest Archive to /tmp..."; | |
/bin/cp -Rp "${ARCHIVE_PATH}" "/tmp/" | |
# Create .ipa in tmp folder | |
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 "Created .ipa for ${PRODUCT_NAME}." | |
# Zip .DSYM | |
echo "Zipping .dSYM for ${PRODUCT_NAME}..." | |
/bin/rm "${DSYM}.zip" | |
/usr/bin/zip -r "${DSYM}.zip" "${DSYM}" | |
echo "Created .dSYM for ${PRODUCT_NAME}." | |
# Upload files to TestFlight | |
echo "*** Uploading ${PRODUCT_NAME} 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="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