Skip to content

Instantly share code, notes, and snippets.

@mokemokechicken
Created August 28, 2013 08:15
Show Gist options
  • Save mokemokechicken/6363430 to your computer and use it in GitHub Desktop.
Save mokemokechicken/6363430 to your computer and use it in GitHub Desktop.
# set these environment variables
#
# PACKAGE_NAME=my-awesome-app
# BUNDLE_IDENTIFIER=com.example.myapp
# MASTER_JENKINS=http://com.example.jenkins:8080
# LOGO_IMG_URL=http://img.example.com/logo.png
############
DIST_URL=${MASTER_JENKINS}/job/${JOB_NAME}/${BUILD_NUMBER}/artifact
DIST_URL_ESC=`echo $DIST_URL | sed 's/=/%3d/g'`
PLIST=build/${PACKAGE_NAME}.plist
INSTALL_PAGE=build/${PACKAGE_NAME}.html
IPA_PATH=$(find . -name '*.ipa' | grep build | head -n 1)
[ -d build ] || mkdir build
cat <<__PLIST__ > $PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>${DIST_URL}/${IPA_PATH}</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>${LOGO_IMG_URL}</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>${BUNDLE_IDENTIFIER}</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>b${BUILD_NUMBER}</string>
<key>title</key>
<string>${PACKAGE_NAME}</string>
</dict>
</dict>
</array>
</dict>
</plist>
__PLIST__
cat <<__HTML__ > $INSTALL_PAGE
<html>
<head>
<title>${PACKAGE_NAME}: build #$BUILD_NUMBER</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head>
<body>
<div style="text-align: center; vertical-align: middle; margin-top: 100px">
<div style="padding: 10px;">$JOB_NAME</div>
<a href="itms-services://?action=download-manifest&url=${DIST_URL_ESC}/${PLIST}"
style="border: none; text-decoration: none; color: #888;">
<br /><br />
Install ${PACKAGE_NAME} b$BUILD_NUMBER
</a>
</div>
</body>
</html>
__HTML__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment