Introduce normalized CI environment vars: ci/env.sh (#4571)

This commit is contained in:
Michael Vines
2019-06-06 12:20:47 -07:00
committed by GitHub
parent 44835a91db
commit 53275cc678
15 changed files with 92 additions and 46 deletions

View File

@ -20,26 +20,20 @@ if [[ -z $GITHUB_TOKEN ]]; then
exit 1
fi
if [[ -n $BUILDKITE_TAG ]]; then
TAG=$BUILDKITE_TAG
elif [[ -n $TRIGGERED_BUILDKITE_TAG ]]; then
TAG=$TRIGGERED_BUILDKITE_TAG
fi
if [[ -z $TAG ]]; then
echo Error: TAG not defined
if [[ -z $CI_TAG ]]; then
echo Error: CI_TAG not defined
exit 1
fi
releaseId=$( \
curl -s "https://api.github.com/repos/$REPO_SLUG/releases/tags/$TAG" \
curl -s "https://api.github.com/repos/$REPO_SLUG/releases/tags/$CI_TAG" \
| grep -m 1 \"id\": \
| sed -ne 's/^[^0-9]*\([0-9]*\),$/\1/p' \
)
echo "Github release id for $TAG is $releaseId"
echo "Github release id for $CI_TAG is $releaseId"
for file in "$@"; do
echo "--- Uploading $file to tag $TAG of $REPO_SLUG"
echo "--- Uploading $file to tag $CI_TAG of $REPO_SLUG"
curl \
--data-binary @"$file" \
-H "Authorization: token $GITHUB_TOKEN" \