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