Gentoo Linux and VIM worshiper, C developer, network protocol dissector implementer,socket/network programmer, recently entered the embedded world, hater of buzzwords and made up titles
#!/bin/bash# Tag revisions like this:# $ git tag -a -m "Version 0.2" v0.2 HEADVF=VERSION
DEFAULT_VERSION=v1.0
LF='
'TAG_TYPE="v*"# First see if there is a version file (included in release tarballs),# then try git-describe, then default.if test-d .git -o-f .git &&VN=$(git describe --abbrev=4 --long--match=$TAG_TYPE HEAD 2>/dev/null)&&case"$VN"in*$LF*)(exit 1);;
v[0-9]*)
git update-index -q--refreshtest-z"$(git diff-index --name-only HEAD --)"||VN="$VN-mod";;esacthen
continue#VN=$(echo "$VN" | sed -e 's/-/./g');else
VN="$DEFAULT_VERSION"fi#VN=$(expr "$VN" : v*'\(.*\)')# Show the version to the user via stderrecho>&2 "$VN"# Parse the existing VERSION-FILE if test-r$VFthen
VC=$(sed-e's/^version: //' <$VF)else
VC=unset
fi# If version has changed, update VERSION-FILEtest"$VN"="$VC"||{echo"$VN">$VFecho>&2 "($VF updated)"}
I use the following scripts to generate some common files. Although they work, you will probably need to tweak them to meet your needs.
CHANGELOG
VERSION
AUTHORS
Wow! Thanks for sharing 👌