diff --git a/.travis.yml b/.travis.yml index a07ea90..1a4d144 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ after_success: - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" - if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then ./build.sh master --push; - ./build.sh develop-2.2 --push; - ./build-latest.sh; + ./build-latest.sh --push; + PRERELEASE=true ./build-latest.sh --push; fi notifications: diff --git a/build-latest.sh b/build-latest.sh index 308d887..7b79091 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -1,7 +1,10 @@ #!/bin/bash -URL_LATEST=https://api.github.com/repos/digitalocean/netbox/releases/latest +URL_LATEST=https://api.github.com/repos/digitalocean/netbox/releases -VERSION=$(curl "${URL_LATEST}" | jq -r ".tag_name") +JQ_LATEST="group_by(.prerelease) | .[] | sort_by(.published_at) | reverse | .[0] | select(.prerelease==${PRERELEASE-false}) | .tag_name" + +VERSION=$(curl "${URL_LATEST}" | jq -r "${JQ_LATEST}") + +./build.sh "${VERSION}" $@ -./build.sh "${VERSION}" --push