From 120c41ded511c2e2d82f7b7356b93756998b2d9b Mon Sep 17 00:00:00 2001 From: thelamer Date: Sat, 25 Jan 2020 08:54:24 -0800 Subject: [PATCH] adding random string to RC if the release allready exists so we can roll more than one if needed --- .travis.yml | 2 +- script/tag | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 script/tag diff --git a/.travis.yml b/.travis.yml index 125ee07f..87333349 100644 --- a/.travis.yml +++ b/.travis.yml @@ -112,7 +112,7 @@ jobs: script: skip before_deploy: - export RELEASE_TAG=$(cat version.txt)-RC - - git tag ${RELEASE_TAG} + - ./script/tag deploy: - provider: releases api_key: $GITHUB_TOKEN diff --git a/script/tag b/script/tag new file mode 100755 index 00000000..5a5bdd9d --- /dev/null +++ b/script/tag @@ -0,0 +1,11 @@ +#! /bin/bash + +# if tag exists append random string to it +CODE=$(curl -s -o /dev/null -I -w "%{http_code}" https://api.github.com/repos/netbootxyz/netboot.xyz/releases/tags/"${RELEASE_TAG}") +echo ${CODE} +if [ "${CODE}" == "404" ]; then + git tag ${RELEASE_TAG} +elif [ "${CODE}" == "200" ]; then + RAND=$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 3 | head -n 1) + git tag ${RELEASE_TAG}${RAND} +fi