scripts: Improve changelog script

* Add number of commits and contributors
* Default to the latest version tag as the "current"
This commit is contained in:
cloudhead 2024-12-04 12:40:10 +01:00
parent 5fe3d5a7ab
commit 8e2fe6449e
No known key found for this signature in database
1 changed files with 9 additions and 3 deletions

View File

@ -23,8 +23,8 @@ while [ $# -gt 0 ]; do
done done
# Current/latest tag. # Current/latest tag.
tag=$(git describe) current=$(git describe --tags --match='v*' --abbrev=0)
version=$(echo $tag | sed 's/^v//') version=$(echo $current | sed 's/^v//')
if [ -z "$from" ]; then if [ -z "$from" ]; then
previous="$(git describe --abbrev=0 HEAD^)" previous="$(git describe --abbrev=0 HEAD^)"
@ -52,9 +52,15 @@ echo
echo "* This update is recommended for everyone. No manual intervention is required." echo "* This update is recommended for everyone. No manual intervention is required."
echo echo
echo "## Changelog" echo "## Changelog"
ncommits=$(git rev-list --count $previous..$current)
ncontribs=$(git log $previous..HEAD --format='%ae' | sort -u | wc -l)
echo
echo "This release contains $ncommits commit(s) by $ncontribs contributor(s)."
echo echo
git log --pretty=format:'* `%h` **%s** *<%ae>*' $previous..HEAD git log --pretty=format:'* `%h` **%s** *<%ae>*' $previous..$current
echo echo
echo "## Checksums" echo "## Checksums"