1#!/usr/bin/env bash 2set -e 3set -x 4# force a failure if there's no tag 5git describe --tags 6# now get the tag 7CURRENT_TAG=$(git describe --tags | cut -f2 -dv) 8# convert v0.2.12-2-g50254a9 to 0.2.12 9CURRENT_TAG_VERSION=$(git describe --tags | cut -f1 -d'-' | cut -f2 -dv) 10# if there's a hash on the tag, then this is not a release tagged commit 11if [ "$CURRENT_TAG" != "$CURRENT_TAG_VERSION" ]; then 12 echo "Current tag version is not a release tag, cut a new release if you want to publish." 13 exit 1 14fi 15 16PUBLISHED_TAG_VERSION=$(curl -s "https://repo.maven.apache.org/maven2/software/amazon/awssdk/crt/aws-crt/maven-metadata.xml" | grep "<latest>" | cut -f2 -d ">" | cut -f1 -d "<") 17if [ "$PUBLISHED_TAG_VERSION" == "$CURRENT_TAG_VERSION" ]; then 18 echo "$CURRENT_TAG_VERSION is already in Sonatype, cut a new tag if you want to upload another version." 19 exit 1 20fi 21 22echo "$CURRENT_TAG_VERSION currently does not exist in Sonatype, allowing pipeline to continue." 23exit 0 24