Debian Codegraph @

continuous-delivery/test-version-exists

raw symbols SCIP
1 #!/usr/bin/env bash
2 set -ex
3 #force a failure if there's no tag
4 GIT_TAG=$(git describe --tags)
5 # Check if the git tag version starts with 'v'
6 if [[ "$GIT_TAG" != v* ]]; then
7 echo "Current tag version does not start with 'v', please ensure the tag is correctly formatted."
8 exit 1
9 fi
10 # now get the tag without leading 'v'
11 CURRENT_TAG=$(echo $GIT_TAG | cut -f2 -dv)
12 # convert v0.2.12-2-g50254a9 to 0.2.12
13 CURRENT_TAG_VERSION=$(git describe --tags | cut -f1 -d'-' | cut -f2 -dv)
14 # if there's a hash on the tag, then this is not a release tagged commit
15 if [ "$CURRENT_TAG" != "$CURRENT_TAG_VERSION" ]; then
16 echo "Current tag version is not a release tag, cut a new release if you want to publish."
17 exit 1
18 fi
19
20 if python3 -m pip install --no-cache-dir -vvv awscrt==$CURRENT_TAG_VERSION; then
21 echo "$CURRENT_TAG_VERSION is already in pypi, cut a new tag if you want to upload another version."
22 exit 1
23 fi
24
25 echo "$CURRENT_TAG_VERSION currently does not exist in pypi, allowing pipeline to continue."
26 exit 0