Skip to content

Commit

Permalink
Helper script to create and possibly push annotated release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomaqa committed Nov 12, 2024
1 parent 03701e6 commit fd98482
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/release-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

ROOT=$(cd $(dirname "$0")/..; pwd)

## Extract the full version from the top-level CMakeLists.txt
function current_version {
local str
for v in MAJOR MINOR PATCH; do
## Concatenate particular version parts
str+=$(sed -n "s/set(OPENSMT_VERSION_${v} \([^ )]*\))/\1/p" <"$ROOT"/CMakeLists.txt).
done
str=${str%.}

printf '%s\n' $str
}

VERSION=$(current_version)
TAG=v${VERSION}
git tag -a $TAG -m "Release $VERSION" || exit $?

printf 'Created release tag "%s"\n' $TAG

read -p 'Do you want to push the tag? [Y/n] ' choice
[[ ${choice,} =~ ^(|y)$ ]] || exit 0

git push origin refs/tags/$TAG

0 comments on commit fd98482

Please sign in to comment.