github.com/Azure/draft@v0.16.0/.circleci/deploy-azure.sh (about) 1 #!/usr/bin/env bash 2 3 set -euo pipefail 4 IFS=$'\n\t' 5 DRAFT_ROOT="${BASH_SOURCE[0]%/*}/.." 6 7 cd "$DRAFT_ROOT" 8 9 # Skip on pull request builds 10 if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then 11 exit 12 fi 13 14 : ${AZURE_CONTAINER:?"AZURE_CONTAINER environment variable is not set"} 15 : ${AZURE_STORAGE_ACCOUNT:?"AZURE_STORAGE_ACCOUNT environment variable is not set"} 16 : ${AZURE_STORAGE_KEY:?"AZURE_STORAGE_KEY environment variable is not set"} 17 18 VERSION= 19 if [[ -n "${CIRCLE_TAG:-}" ]]; then 20 VERSION="${CIRCLE_TAG}" 21 elif [[ "${CIRCLE_BRANCH:-}" == "master" ]]; then 22 VERSION="canary" 23 else 24 echo "skipping because this is neither a push to master or a pull request." 25 exit 26 fi 27 28 echo "Installing Azure components" 29 # NOTE(bacongobbler): azure-cli needs a newer version of libffi/libssl. See https://github.com/Azure/azure-cli/issues/3720#issuecomment-350335381 30 apt-get update && apt-get install -yq python-pip libffi-dev libssl-dev 31 easy_install pyOpenSSL 32 pip install --disable-pip-version-check --no-cache-dir azure-cli~=2.0 33 34 echo "Building Draft binaries" 35 make GOXFLAGS="-parallel 3" clean build-cross 36 VERSION="${VERSION}" make dist checksum 37 38 echo "Pushing binaries to Azure Blob Storage" 39 az storage blob upload-batch --source _dist/ --destination "${AZURE_CONTAINER}" --pattern *.tar.gz* 40 az storage blob upload-batch --source _dist/ --destination "${AZURE_CONTAINER}" --pattern *.zip*