-
-
Save pegakmupyem/644a1c2a090488baa6d96a20d1bfc1d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Getting Variables | |
| PLIST_BUDDY=/usr/libexec/PlistBuddy | |
| BUILT_PRODUCT=$(ls -d build/*iphone*/*app | head -1) | |
| PRODUCT_BASENAME=$(basename "$BUILT_PRODUCT") | |
| APPLICATION_NAME=${PRODUCT_BASENAME%.app} | |
| INFO_PLIST="$BUILT_PRODUCT"/Info.plist | |
| BUNDLE_IDENTIFIER=$($PLIST_BUDDY -c 'Print CFBundleIdentifier' "$INFO_PLIST") | |
| BUNDLE_VERSION=$($PLIST_BUDDY -c 'Print CFBundleVersion' "$INFO_PLIST") | |
| DISPLAY_NAME=$($PLIST_BUDDY -c 'Print CFBundleDisplayName' "$INFO_PLIST") | |
| EXECUTABLE="${BUILT_PRODUCT}"/$($PLIST_BUDDY -c 'Print CFBundleExecutable' "$INFO_PLIST") | |
| UUID=$(otool -l "${EXECUTABLE}" | grep uuid | cut -d" " -f6 | head -1) | |
| HTTP_IPA_URL=$HTTP_DEPLOY_URL/${APPLICATION_NAME}.ipa | |
| HTTP_PLIST_URL=$HTTP_DEPLOY_URL/ota.plist | |
| SVN_REVISION=$(svn info | grep Revision | grep -o "[0-9]*$") | |
| SVN_BRANCH=$(svn info | grep URL | cut -d" " -f2-) | |
| TIMESTAMP=$(date) | |
| echo "ARCHIVING BUILD" | |
| echo "===============" | |
| echo | |
| echo "Deploy URL: $DEPLOY_URL" | |
| echo "HTTP Deploy URL: $HTTP_DEPLOY_URL" | |
| echo "Provisioning Profile: $PROVISION_PROFILE" | |
| echo "Built Product: $BUILT_PRODUCT" | |
| echo "Application Name: $APPLICATION_NAME" | |
| echo "Bundle Identifier: $BUNDLE_IDENTIFIER" | |
| echo "Bundle Version: $BUNDLE_VERSION" | |
| echo "Display Name: $DISPLAY_NAME" | |
| echo "Executable: $EXECUTABLE" | |
| echo "UUID: $UUID" | |
| echo "SVN Revision: $SVN_REVISION" | |
| echo "SVN Branch: $SVN_BRANCH" | |
| echo "Timestamp: $TIMESTAMP" | |
| echo | |
| xcrun -sdk iphoneos PackageApplication "$BUILT_PRODUCT" -o "$PWD/artifacts/${APPLICATION_NAME}.ipa" --sign "iPhone Distribution" --embed BuildConfig/Signing/profiles/"$PROVISION_PROFILE" | |
| if [ "$?" -ne 0 ] ; then echo "Failed to package the application"; exit 1; fi | |
| TITLE=$DISPLAY_NAME | |
| SUBTITLE="" | |
| URL=$(echo $HTTP_IPA_URL | sed 's/\//\\\//g') # escaping the / in the URL that break the regexp | |
| URLENCODED_PLIST_URL=$(python -c "import urllib ; print urllib.quote(\"${HTTP_PLIST_URL}\")") | |
| URLENCODED_PLIST_URL=$(echo $URLENCODED_PLIST_URL | sed 's/\//\\\//g') | |
| SVN_BRANCH=$(echo $SVN_BRANCH | sed 's/\//\\\//g') # escaping the / in the URL that break the regexp | |
| sed -e"s/__TITLE__/${TITLE}/g" \ | |
| -e"s/__SUBTITLE__/${SUBTITLE}/g" \ | |
| -e"s/__BUNDLE_IDENTIFIER__/${BUNDLE_IDENTIFIER}/g" \ | |
| -e"s/__BUNDLE_VERSION__/${BUNDLE_VERSION}/g" \ | |
| -e"s/__URL__/${URL}/g" \ | |
| BuildConfig/ota.plist.template > artifacts/ota.plist | |
| sed -e"s/__DISPLAY_NAME__/${DISPLAY_NAME}/g" \ | |
| -e"s/__BUNDLE_VERSION__/${BUNDLE_VERSION}/g" \ | |
| -e"s/__URLENCODED_PLIST_URL__/${URLENCODED_PLIST_URL}/g" \ | |
| -e"s/__REVISION__/${SVN_REVISION}/g" \ | |
| -e"s/__BRANCH__/${SVN_BRANCH}/g" \ | |
| -e"s/__TIMESTAMP__/${TIMESTAMP}/g" \ | |
| BuildConfig/ota.index.html.template > artifacts/index.html | |
| if [ x$DEPLOY_URL != x ] ; then | |
| USER=$(echo $DEPLOY_URL | cut -d@ -f1) | |
| HOST=$(echo $DEPLOY_URL | cut -d@ -f2 | cut -d: -f1) | |
| REMOTE_PATH=$(echo $DEPLOY_URL | cut -d: -f2) | |
| echo Deploying IPA to $DEPLOY_URL | |
| chmod 600 BuildConfig/file-dev-deploy.privatekey | |
| ## OMISSIS ### | |
| if [ "$?" -ne 0 ] ; then echo "Failed to scp the ipa to the server "; exit 1; fi | |
| fi | |
| echo IPA ARCHIVE SUCCESFULL |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>__DISPLAY_NAME__ Installation</title> | |
| <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet"> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <script> | |
| function onload() { | |
| var qr = document.getElementById("qr") | |
| qr.src = "http://qrickit.com/api/qr?qrsize=300&d=" + encodeURIComponent(document.documentURI) | |
| } | |
| </script> | |
| <body onload="onload();" class="container"> | |
| <h1>__DISPLAY_NAME__ Installation</h1> | |
| <p>To install __DISPLAY_NAME__ version __BUNDLE_VERSION__ visit this page with an iOS device and click the install button. | |
| <hr> | |
| <p style="text-align:center"><a href="itms-services://?action=download-manifest&url=__URLENCODED_PLIST_URL__" class="btn btn-primary">Install the application</a> | |
| <hr> | |
| <div class="row"> | |
| <div class="span5"> | |
| <h3>Compilation Summary</h3> | |
| <dl class="dl-horizontal"> | |
| <dt>Display Name</dt> | |
| <dd>__DISPLAY_NAME__</dd> | |
| <dt>Version Number</dt> | |
| <dd>__BUNDLE_VERSION__</dd> | |
| <dt>SVN Revision Number</dt> | |
| <dd>__REVISION__</dd> | |
| <dt>SVN Branch</dt> | |
| <dd>__BRANCH__</dd> | |
| <dt>Timestamp</dt> | |
| <dd>__TIMESTAMP__</dd> | |
| </dl> | |
| </div> | |
| <div class="span4"> | |
| <h3>QR Shortcut</h3> | |
| <p>For your convenience, here it is a QR code that points to <em>this</em> page. | |
| <p><img id="qr" src="" width="300" height="300"> | |
| </div> |
This file contains hidden or 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
| <?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>__URL__</string> | |
| </dict> | |
| </array> | |
| <key>metadata</key> | |
| <dict> | |
| <key>bundle-identifier</key> | |
| <string>__BUNDLE_IDENTIFIER__</string> | |
| <key>bundle-version</key> | |
| <string>__BUNDLE_VERSION__</string> | |
| <key>kind</key> | |
| <string>software</string> | |
| <key>subtitle</key> | |
| <string>__SUBTITLE__</string> | |
| <key>title</key> | |
| <string>__TITLE__</string> | |
| </dict> | |
| </dict> | |
| </array> | |
| </dict> | |
| </plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment