Suggest minor bump on breaking changes

https://www.conventionalcommits.org/en/v1.0.0/

closed #11
This commit is contained in:
ChillerDragon 2023-06-01 10:40:26 +02:00
parent 9f06c95e8d
commit 6c158c8841

View file

@ -1,5 +1,8 @@
#!/bin/bash
YELLOW="\e[0;33m"
RESET="\e[0m"
if [ ! -f ./scripts/run_tests.sh ]
then
echo "Error: ./scripts/run_tests.sh not found"
@ -82,6 +85,21 @@ then
exit 1
fi
function commits_since_last_tag() {
git log "$(git describe --tags --abbrev=0)..HEAD" --pretty=format:'%s'
}
function list_api_breaking_commits() {
printf '%b' "$YELLOW"
if commits_since_last_tag | grep -F '!: '
then
printf '%b' "$RESET"
return 0
fi
printf '%b' "$RESET"
return 1
}
if ! latest_tag="$(git tag | sort -V | tail -n1)"
then
echo "Error: failed to get latest tag"
@ -101,6 +119,18 @@ echo " - change internal (local variables etc) api -> patch version bump"
echo " - drastic user affecting change -> major version bump"
echo "Only a patch version change should NEVER break a users code"
echo "==================================================================="
echo ""
if list_api_breaking_commits
then
echo ""
echo "=!= Found api breaking commits! See list above ^^^ =!="
echo "=!= Do at least a minor version jump due to breaking changes =!="
echo "=!= https://www.conventionalcommits.org/en/v1.0.0/ =!="
echo "==================================================================="
fi
read -r -p "tag name: " -i "$latest_tag" -e tag_name
if [ "$tag_name" == "" ]
then