Created
November 11, 2014 22:43
-
-
Save aijaz/81d6ca5ae5f3e86dab3c to your computer and use it in GitHub Desktop.
Upload an iOS archive to HockeyApp
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/sh | |
# uploadToHockey.sh | |
# | |
# Created by Aijaz Ansari | |
# Released under the MIT License | |
# Expected environment variables | |
# From XCode: | |
# * ARCHIVE_DSYMS_PATH | |
# * PRODUCT_NAME | |
# * ARCHIVE_PRODUCTS_PATH | |
# From User-defined Build Settings: | |
# * HOCKEY_TAG | |
# * HOCKEY_API_TOKEN | |
# * HOCKEY_APP_ID | |
# ARCHIVE_DSYMS_PATH & ARCHIVE_PRODUCTS_PATH is available to Post Archive Actions per | |
# Xcode 4.0 Developer Preview 5 Release Notes at | |
# https://developer.apple.com/library/ios/releasenotes/developertools/rn-xcode/#//apple_ref/doc/uid/TP40001051-SW72 | |
DSYM="${ARCHIVE_DSYMS_PATH}/${PRODUCT_NAME}.app.dSYM" | |
APP="${ARCHIVE_PRODUCTS_PATH}/Applications/${PRODUCT_NAME}.app" | |
IPA_PATH=/tmp/${PRODUCT_NAME}.ipa | |
DSYM_PATH=/tmp/${PRODUCT_NAME}.dSYM.zip | |
TEMP_JSON=/tmp/${PRODUCT_NAME}json | |
CURL_SCRIPT=/tmp/curl.sh | |
# create the IPA | |
# got this command from http://stackoverflow.com/questions/8334500/generating-ipa-from-xcode-command-line | |
# | |
/bin/rm "$IPA_PATH" | |
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "$IPA_PATH" | |
# Zip DSYM for upload | |
# | |
/bin/rm "$DSYM_PATH" | |
/usr/bin/zip -r "$DSYM_PATH" "${DSYM}" | |
/bin/rm $TEMP_JSON | |
# perform HockeyApp Upload | |
# perform the upload | |
`/usr/bin/curl \ | |
-F "status=2" \ | |
-F "notify=1" \ | |
-F "notes=<${PROJECT_DIR}/Build/releaseNotes.md" \ | |
-F "notes_type=1" \ | |
-F "tags=${HOCKEY_TAG}" \ | |
-F "ipa=@$IPA_PATH" \ | |
-F "dsym=@$DSYM_PATH" \ | |
-H "X-HockeyAppToken: $HOCKEY_API_TOKEN" \ | |
-o $TEMP_JSON \ | |
https://rink.hockeyapp.net/api/2/apps/$HOCKEY_APP_ID/app_versions/upload` | |
# comment the next two lines if you DON'T want the build page to open upon completion | |
CONFIG_URL=`/usr/local/bin/perl -MJSON -e '$i=<STDIN>; $p=from_json($i); print "$p->{config_url}\n";' < $TEMP_JSON` | |
open $CONFIG_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment