github.com/stefanmcshane/helm@v0.0.0-20221213002717-88a4a2c6e77d/.circleci/deploy.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright The Helm Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  set -euo pipefail
    17  
    18  # Skip on pull request builds
    19  if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then
    20    exit
    21  fi
    22  
    23  : ${AZURE_STORAGE_CONNECTION_STRING:?"AZURE_STORAGE_CONNECTION_STRING environment variable is not set"}
    24  : ${AZURE_STORAGE_CONTAINER_NAME:?"AZURE_STORAGE_CONTAINER_NAME environment variable is not set"}
    25  
    26  VERSION=
    27  if [[ -n "${CIRCLE_TAG:-}" ]]; then
    28    VERSION="${CIRCLE_TAG}"
    29  elif [[ "${CIRCLE_BRANCH:-}" == "main" ]]; then
    30    VERSION="canary"
    31  else
    32    echo "Skipping deploy step; this is neither a releasable branch or a tag"
    33    exit
    34  fi
    35  
    36  echo "Installing Azure CLI"
    37  echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ jammy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
    38  curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add
    39  sudo apt install apt-transport-https
    40  sudo apt update
    41  sudo apt install azure-cli
    42  
    43  
    44  echo "Building helm binaries"
    45  make build-cross
    46  make dist checksum VERSION="${VERSION}"
    47  
    48  echo "Pushing binaries to Azure"
    49  if [[ "${VERSION}" == "canary" ]]; then
    50    az storage blob upload-batch -s _dist/ -d "$AZURE_STORAGE_CONTAINER_NAME" --pattern 'helm-*' --connection-string "$AZURE_STORAGE_CONNECTION_STRING" --overwrite
    51  else
    52    az storage blob upload-batch -s _dist/ -d "$AZURE_STORAGE_CONTAINER_NAME" --pattern 'helm-*' --connection-string "$AZURE_STORAGE_CONNECTION_STRING"
    53  fi