Skip to content

Instantly share code, notes, and snippets.

@reklis
Created September 30, 2011 15:42

Revisions

  1. Steven Fusco created this gist Sep 30, 2011.
    35 changes: 35 additions & 0 deletions build.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    #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/"
    9 changes: 9 additions & 0 deletions prompt.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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