Skip to content

Commit

Permalink
👷 misc(release): verify version tag format on release
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo committed Feb 7, 2024
1 parent c193d4d commit fcf16a4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions release
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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

Expand Down

0 comments on commit fcf16a4

Please sign in to comment.