summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-04-06 13:10:41 -0400
committerJason Wray <jason@mapbox.com>2016-04-20 18:54:12 -0400
commitf4d8a7d5d522156220f94fbfb1e64d4be31cfb0d (patch)
treeda0d7065828cdc52cc6f10c51644959ebcb2be2b /platform
parentd07e5b5f51b190cc7798c46249e99485172ecc22 (diff)
downloadqtlocation-mapboxgl-f4d8a7d5d522156220f94fbfb1e64d4be31cfb0d.tar.gz
[ios] Add script to automate s3 build and publish process
A large part of the iOS SDK deploy process is creating the various binary flavors, uploading them to s3, and then testing that those uploads worked by downloading them from s3 before uploading and attaching them to the github release. This script automates that build, upload, download, upload and attach process and can be run after `mbx auth`. Cherry-picked from 89db01fef0abe258e152eeb2013358c74f8bfeec.
Diffstat (limited to 'platform')
-rwxr-xr-xplatform/ios/scripts/deploy-packages.sh84
1 files changed, 84 insertions, 0 deletions
diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh
new file mode 100755
index 0000000000..64cb472f6b
--- /dev/null
+++ b/platform/ios/scripts/deploy-packages.sh
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+set -u
+
+usage() {
+cat <<EOF
+# Usage: sh $0 version target_directory [argument]
+
+# version: The semver version plus optional alpha beta distinction (i.e. {major.minor.patch}{-alpha.N})
+# target_directory: The directory where build output should be placed
+
+# argument:
+# -g: Upload to github
+
+# environment variables and dependencies:
+# - You must run "mbx auth ..." before running
+# - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE
+# - "wget" is required for downloading the zip files from s3
+# - The "github-release" gem is required to use GITHUB_RELEASE
+EOF
+}
+
+buildPackageStyle() {
+ local package=$1 style=""
+ if [[ ${#} -eq 2 ]]; then
+ style="$2"
+ fi
+ echo "make ${package} ${style}"
+ make ${package}
+ echo "publish ${package} with ${style}"
+ local file_name=""
+ if [ -z ${style} ]
+ then
+ ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}"
+ file_name=mapbox-ios-sdk-${PUBLISH_VERSION}.zip
+ else
+ ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" ${style}
+ file_name=mapbox-ios-sdk-${PUBLISH_VERSION}-${style}.zip
+ fi
+ echo "Downloading ${file_name} from s3... to ${BINARY_DIRECTORY}"
+ wget -P ${BINARY_DIRECTORY} http://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/${file_name}
+ if [[ "${GITHUB_RELEASE}" == true ]]; then
+ echo "publish ${file_name} to GitHub"
+ github-release --verbose upload --tag "ios-v${PUBLISH_VERSION}" --name ${file_name} --file "${BINARY_DIRECTORY}/${file_name}"
+ fi
+}
+
+if [ ${#} -eq 0 -o ${#} -gt 3 ]; then
+ usage
+ exit 1
+fi
+
+export TRAVIS_REPO_SLUG=mapbox-gl-native
+export PUBLISH_VERSION=$1
+export GITHUB_USER=mapbox
+export GITHUB_REPO=mapbox-gl-native
+
+BINARY_DIRECTORY=$2
+PUBLISH_PRE_FLAG=''
+GITHUB_RELEASE=false
+
+echo "Deploying version ${PUBLISH_VERSION}..."
+
+if [[ ${#} -eq 3 && $3 == "-g" ]]; then
+ GITHUB_RELEASE=true
+fi
+
+make clean && make distclean
+
+if [[ "${GITHUB_RELEASE}" == true ]]; then
+ echo "Create GitHub release..."
+ if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then
+ PUBLISH_PRE_FLAG='--pre-release'
+ fi
+ github-release --verbose release --tag "ios-v${PUBLISH_VERSION}" --name "ios-v${PUBLISH_VERSION}" --draft ${PUBLISH_PRE_FLAG}
+fi
+
+buildPackageStyle "ipackage" "symbols"
+buildPackageStyle "ipackage-strip"
+buildPackageStyle "iframework" "symbols-dynamic"
+buildPackageStyle "iframework SYMBOLS=NO" "dynamic"
+buildPackageStyle "ifabric" "fabric"