ansible-collection-prometheus/roles/prometheus/bump_version.sh
Paweł Krupa (paulfantom) dcfbfa84d2 initial migration of roles from cloudalchemy
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
2022-09-23 13:29:55 +02:00

25 lines
684 B
Bash
Executable file

#!/usr/bin/env bash
#
# Description: Generate the next release version
set -uo pipefail
latest_tag="$(git semver)"
if [[ -z "${latest_tag}" ]]; then
echo "ERROR: Couldn't get latest tag from git semver, try 'pip install git-semver'" 2>&1
exit 1
fi
# Use HEAD if CIRCLE_SHA1 is not set.
now="${CIRCLE_SHA1:-HEAD}"
new_tag='none'
git_log="$(git log --format=%B "${latest_tag}..${now}")"
case "${git_log}" in
*"[major]"*|*"[breaking change]"* ) new_tag=$(git semver --next-major) ;;
*"[minor]"*|*"[feat]"*|*"[feature]"* ) new_tag=$(git semver --next-minor) ;;
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) new_tag=$(git semver --next-patch) ;;
esac
echo "NEW_TAG=${new_tag}"