Skip to content

Commit

Permalink
add script to get version description
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Oct 28, 2024
1 parent 596466d commit 33e781b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/git-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
D=`date +%Y%m%d-%H%M`
TAG=`git describe --dirty --tags --match 'v[0-9]*' --always | sed -e 's/^v//; s/-dirty/-'"$D/"`
SUFF=`echo $TAG | sed -e 's/[^-]*//'`
if [ "X$SUFF" = "X" ] ; then
# if no -hash or -dirty, just take the tag
echo "$TAG"
else
# otherwise, bump the last number of semver
# in semver 0.0.7 > 0.0.7-something (think 0.0.7-rc4)
PREF=`echo $TAG | sed -e 's/-.*//; s/\(.*\)\.[0-9]*/\1/'`
LAST=`echo $TAG | sed -e 's/-.*//; s/.*\.//'`
echo "$PREF.$(($LAST+1))$SUFF"
fi

0 comments on commit 33e781b

Please sign in to comment.