Skip to content

Commit

Permalink
Avoiding Duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarrarom committed May 19, 2019
1 parent e5fa32f commit 0525a19
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 0525a19

Please sign in to comment.