mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-26 05:40:18 +00:00
dcfbfa84d2
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
25 lines
684 B
Bash
Executable file
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}"
|