1#! /bin/bash 2echo Slug $TRAVIS_PULL_REQUEST_SLUG 3if [ -z $TRAVIS_PULL_REQUEST_SLUG ] && [ "$TRAVIS_PULL_REQUEST_SLUG" != "airbnb/lottie-android" ]; then 4 echo "Skipping gcloud setup for PR because api keys are not available from forks." 5 exit 0 6fi 7echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json 8curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-182.0.0-linux-x86_64.tar.gz -o gcloud.tar.gz 9tar xzf gcloud.tar.gz -C ${HOME} 10${HOME}/google-cloud-sdk/install.sh --quiet --usage-reporting false 11gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json 12 # - gcloud components update 13gcloud config set project lottie-snapshots 14export TRAVIS_GIT_BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) 15export GIT_SHA=$(git rev-parse HEAD) 16export GIT_MERGE_BASE=$(git merge-base master) 17echo GIT_SHA $GIT_SHA 18echo GIT_MERGE_BASE $GIT_MERGE_BASE