From 0525a1960b9db6bca962b7cfa809a5e75bd1c844 Mon Sep 17 00:00:00 2001 From: Guilherme Carraro Martins Date: Sun, 19 May 2019 17:23:15 -0400 Subject: [PATCH] Avoiding Duplicates --- azure-pipelines.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 27186c9..0709d39 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,23 @@ steps: displayName: 'Use Python $(python.version)' - script: | + echo "Getting version from the setup.py file..." ApplicationVersion=$(cat setup.py | grep version | cut -d '=' -f 2 | cut -d "'" -f 2) + echo "setup.py file version: $ApplicationVersion" + echo "Testing if this version already exists in GitHub..." + echo "Get the tags first..." + tags=$(curl https://api.github.com/repos/gcarrarom/kubeconfig-cleaner-cli/tags) + + echo "check if there's a match on the version.." + Match=$(echo $tags | jq -r ".[] | select(.name == \"v$ApplicationVersion\")") + + if [[ -z "$Match" ]]; then + echo "All good, this doesn't match any old versions" + else + echo "Nope, we have this already... try choosing another one ;)" + exit 100 + fi + echo "Version to be used: $ApplicationVersion" echo "##vso[task.setvariable variable=ApplicationVersion]$ApplicationVersion" displayName: 'Get application Version'