Created
November 26, 2015 23:07
-
-
Save aspnetde/e895ddfdfa4f7a24fb15 to your computer and use it in GitHub Desktop.
A small script that uses XCode's Application Loader to automatically submit an IPA to iTunes Connect
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 | |
set -ex | |
# Originally from https://gist.github.com/jedi4ever/b1f8b27d4a803d487fa4 | |
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id | |
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status | |
# Requires application loader to be installed | |
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html | |
# Itunes Connect username & password | |
USER='' | |
PASS='' | |
# App id as in itunes store create, not in your developer account | |
APP_ID='' | |
IPA_FILE=$1 | |
IPA_FILENAME=$(basename $IPA_FILE) | |
MD5=$(md5 -q $IPA_FILE) | |
BYTESIZE=$(stat -f "%z" $IPA_FILE) | |
TEMPDIR=itsmp | |
# Remove previous temp | |
test -d ${TEMPDIR} && rm -rf ${TEMPDIR} | |
mkdir ${TEMPDIR} | |
mkdir ${TEMPDIR}/mybundle.itmsp | |
# You can see this debug info when you manually do an app upload with the Application Loader | |
# It's when you click activity | |
cat <<EOM > ${TEMPDIR}/mybundle.itmsp/metadata.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<package version="software4.7" xmlns="http://apple.com/itunes/importer"> | |
<software_assets apple_id="$APP_ID"> | |
<asset type="bundle"> | |
<data_file> | |
<file_name>$IPA_FILENAME</file_name> | |
<checksum type="md5">$MD5</checksum> | |
<size>$BYTESIZE</size> | |
</data_file> | |
</asset> | |
</software_assets> | |
</package> | |
EOM | |
cp ${IPA_FILE} $TEMPDIR/mybundle.itmsp | |
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/itms/bin/iTMSTransporter -m upload -f ${TEMPDIR} -u "$USER" -p "$PASS" -v detailed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a great script but its old school. Check out altool, it comes with application loader now. Pretty much same thing but you don't have to create the itmsp file, you can give an IPA