ci-demo-2/version-auto-update.sh

26 lines
600 B
Bash
Executable File

#!/usr/bin/env bash
read -r msg
echo "read the following commit message: $msg"
if [[ $msg = *"BREAKING CHANGE:"* ]]; then
echo "detected breaking change, updating major version"
./update-version.sh MAJOR
fi
summary=$(echo "$msg" | head -1)
type=$(cut -d':' -f1 <<< "$summary")
if [[ $type = *"!"* ]]; then
echo "detected breaking change, updating major version"
./version-update.sh MAJOR
fi
if [[ $type = "feat" ]]; then
echo "detected feature, updating minor version"
./version-update.sh MINOR
else
echo "last commit message does not indicate a base version update, skipping"
fi