Commit 4cccd57c authored by Nolan Brubaker's avatar Nolan Brubaker
Browse files

Use Travis's tag env var for latest calculation

Signed-off-by: default avatarNolan Brubaker <brubakern@vmware.com>
parent eccaa81a
Showing with 11 additions and 23 deletions
+11 -23
#!/bin/sh
# Return value is written into LATEST
LATEST=""
function latest_release() {
# Loop through the tags since pre-release versions come before the actual versions.
# Iterate til we find the first non-pre-release
for t in $(git tag -l --sort=-v:refname);
do
# If the tag has alpha, beta or rc in it, it's not "latest"
if [[ "$t" == *"beta"* || "$t" == *"alpha"* || "$t" == *"rc"* ]]; then
continue
fi
LATEST="$t"
break
done
LATEST=false
function is_latest_release() {
# If the tag has alpha, beta or rc in it, it's not "latest"
if [[ "$TRAVIS_TAG" == *"beta"* || "$TRAVIS_TAG" == *"alpha"* || "$TRAVIS_TAG" == *"rc"* ]]; then
LATEST=false
else
LATEST=true
fi
}
# Always publish for master
if [ "$BRANCH" == "master" ]; then
VERSION="$BRANCH" make all-containers all-push
......@@ -24,14 +18,8 @@ fi
# Publish when TRAVIS_TAG is defined.
if [ ! -z "$TRAVIS_TAG" ]; then
# Calculate the latest release
latest_release
# Default to pre-release
TAG_LATEST=false
if [[ "$TRAVIS_TAG" == "$LATEST" ]]; then
TAG_LATEST=true
fi
# Check if this is the latest release.
is_latest_release
VERSION="$TRAVIS_TAG" TAG_LATEST="$TAG_LATEST" make all-containers all-push
VERSION="$TRAVIS_TAG" TAG_LATEST="$LATEST" make all-containers all-push
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment