diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-06-14 10:14:03 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-06-14 10:14:03 -0700 |
commit | 1d43f92859f74b58d5fe8f6e7e7f880777605e61 (patch) | |
tree | 1df8e03f805c9faf3ad394ba1ea8ded569fff476 | |
parent | 23da7064f06f920406aca7144a4e253be1d6f3ae (diff) | |
download | qtlocation-mapboxgl-1d43f92859f74b58d5fe8f6e7e7f880777605e61.tar.gz |
[macos] Deployment script
Adapted the iOS SDK deployment script for the macOS SDK.
-rwxr-xr-x | platform/macos/scripts/deploy-packages.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh new file mode 100755 index 0000000000..84b5afa5cf --- /dev/null +++ b/platform/macos/scripts/deploy-packages.sh @@ -0,0 +1,78 @@ +#!/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 + file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip + else + file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip + fi + if [[ "${GITHUB_RELEASE}" == true ]]; then + echo "publish ${file_name} to GitHub" + github-release --verbose upload --tag "macos-v${PUBLISH_VERSION}" --name ${file_name} --file "build/macos/pkg/${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 +export BUILDTYPE=Release + +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 "macos-v${PUBLISH_VERSION}" --name "macos-v${PUBLISH_VERSION}" --draft ${PUBLISH_PRE_FLAG} +fi + +buildPackageStyle "xpackage" "symbols" +buildPackageStyle "xpackage SYMBOLS=NO" |