From fcf16a457eac2f6daa15c9e7159713e2c78de709 Mon Sep 17 00:00:00 2001 From: welpo Date: Wed, 7 Feb 2024 16:27:54 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20misc(release):=20verify=20versio?= =?UTF-8?q?n=20tag=20format=20on=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- release | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/release b/release index 6b16ac968..b416ed690 100644 --- a/release +++ b/release @@ -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