hydra-maester/.circleci/release_name.bash
2019-08-01 11:33:22 +02:00

14 lines
443 B
Bash
Executable File

#!/bin/bash
release=$(curl -s "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases")
tag=$(echo ${release} | jq -r ".[0].tag_name")
tag_name=$(echo ${release} | jq -r ".[0].name")
if [[ -n "$tag_name" ]]; then
echo "export RELEASE_NAME=$tag_name" >> $BASH_ENV
elif [[ -n "$tag" ]]; then
echo "export RELEASE_NAME=$tag" >> $BASH_ENV
else
echo "export RELEASE_NAME=$CIRCLE_SHA1" >> $BASH_ENV
fi