👷 misc(release): verify version tag format on release

main
welpo 1 year ago
parent c193d4d4e8
commit fcf16a457e
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -3,6 +3,8 @@
# Inspired by https://github.com/orhun/git-cliff/blob/main/release.sh
set -eu
VERSION_FORMAT="^v[0-9]+\.[0-9]+\.[0-9]+$"
# Check for a clean working directory.
if [ -n "$(git status --porcelain)" ]; then
echo "Your working directory is dirty. Commit or stash your changes before running this script."
@ -28,6 +30,15 @@ else
fi
fi
# Verify that the version tag matches the expected format.
if ! [[ $VERSION_TAG =~ $VERSION_FORMAT ]]; then
echo "Version tag $VERSION_TAG does not match the expected format ${VERSION_FORMAT}."
exit 1
fi
echo "Preparing release ${VERSION_TAG}…"
echo
# Update CHANGELOG.
git cliff --tag "$VERSION_TAG" -o CHANGELOG.md

Loading…
Cancel
Save