From 33b14758402024f9ca619b29c1776a1b4a622ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Mon, 2 Oct 2017 11:08:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Build=20pre-released=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... instead of development branches. --- .travis.yml | 4 ++-- build-latest.sh | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) 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