1
0
Эх сурвалжийг харах

adding random string to RC if the release allready exists so we can roll more than one if needed

thelamer 5 жил өмнө
parent
commit
120c41ded5
2 өөрчлөгдсөн 12 нэмэгдсэн , 1 устгасан
  1. 1 1
      .travis.yml
  2. 11 0
      script/tag

+ 1 - 1
.travis.yml

@@ -112,7 +112,7 @@ jobs:
       script: skip
       script: skip
       before_deploy:
       before_deploy:
         - export RELEASE_TAG=$(cat version.txt)-RC
         - export RELEASE_TAG=$(cat version.txt)-RC
-        - git tag ${RELEASE_TAG}
+        - ./script/tag
       deploy:
       deploy:
         - provider: releases
         - provider: releases
           api_key: $GITHUB_TOKEN
           api_key: $GITHUB_TOKEN

+ 11 - 0
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