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'