12

I found that Testflight is supporting application uploading through API call http://testflightapp.com/api/builds.format. It accepts application package, dsyms, application info and other.

So my question is next: Is there any automatic script for xcode which will upload build into Testflight after "archive" operation? Share the links, please.

SOLUTION IS HERE (Mac OS X 10.8):

1) Follow this manual and setup post-execution script

2) Remove Replace "echo" strings with next rule:

#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#

API_TOKEN="<YOUR-TESTFLIGHT-API-TOKEN>"
TEAM_TOKEN="<YOUR-TESTFLIGHT-TEAM-TOKEN>"
SIGNING_IDENTITY="iPhone Developer"
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/<YOUR-PROFILE-NAME>.mobileprovision"
LOG="/tmp/testflight.log"
GROWL="/usr/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."

#echo "done." >> $LOG
${GROWL} "Uploaded to TestFlight"
/usr/bin/open "https://testflightapp.com/dashboard/builds/"

3) Reveal provision profile in finder: go to Organazier/Devices/Provision profiles, then right mouse on your profile, and click "Reveal in finder". Copy profile name and paste to PROVISIONING_PROFILE variable instead of <YOUR-PROFILE-NAME>

4) Open terminal and install terminal-notifier:

sudo gem install terminal-notifier

5) You're ready :)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Roman Truba
  • 4,401
  • 3
  • 35
  • 60
  • doesn't seem to upload for me. Although I do get the final notification, Uploaded to Testflight, but nothing has been uploaded. the notification "Uploaded" appears way to quick for a 15Mb upload, which makes me suspect the upload has failed without any warning. any tips? thanks – Bach Jul 10 '13 at 01:31
  • Check for provision profile and SIGNING_IDENTITY is right. Is the file appear in /tmp ? – Roman Truba Jul 10 '13 at 11:41
  • The above `curl` command is not longer supported, you'll need to use `altool` to submit the binary – alfwatt Oct 08 '18 at 19:43
  • @alfwatt yeah, I believe this thread is a bit outdated. – Roman Truba Oct 11 '18 at 16:07

4 Answers4

3

I've also created a ruby gem for this if you want to integrate this into rake tasks:

gem install testflight_upload

source on my github here

Miles
  • 1,615
  • 4
  • 17
  • 42
2

Here's a nice collection of utilities http://nomad-cli.com/

I ended up using Shenzen to automate builds and testflight deployments.

Bach
  • 2,684
  • 5
  • 26
  • 36
  • Shenzen for me is broken right now. It does not seem to be under much active development. – Alper Aug 13 '13 at 12:03
1

Here is one nice tutorial..may be useful for you:

http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode/

Guru
  • 21,652
  • 10
  • 63
  • 102
  • 1
    Almost there :) here few notices: 1) to reveal PROVISIONING_PROFILE go to Organazier/Devices/Provision profiles, then right mouse on your profile, and click "Reveal in finder"; 2) you can use just "iPhone Developer" as SIGNING_IDENTITY; 3) instead of GROWL use terminal-notifier. – Roman Truba Mar 19 '13 at 10:47
  • The link is dead – Pavan K Feb 18 '21 at 10:36
  • @PavanK sorry for that...I use https://www.diawi.com for TestFlight purpose..just drag iPad to upload. – Guru Feb 18 '21 at 14:43
0

Shenzhen is discontinued, you can use pilot instead. It's a Ruby based tool to upload new builds and manage your beta testers. Under the hood it uses the iTunes Transporter and spaceship.

KrauseFx
  • 11,551
  • 7
  • 46
  • 53