feature: add script for release notes

This commit is contained in:
Jan 2024-05-12 13:34:47 +02:00
parent ac62e47083
commit 783bfb47dc
2 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,24 @@
#!/bin/bash
# Get tags sorted by creation date
tags=$(git tag --sort=creatordate)
# Convert tags into an array using IFS
IFS=$'\n' tagArray=("$tags")
# Get the number of tags
len=${#tagArray[@]}
# Extract the last and second last tags based on length
latestTag=${tagArray[$len-1]}
secondLastTag=${tagArray[$len-2]}
# Check if the tags are assigned correctly
if [ -z "$latestTag" ] || [ -z "$secondLastTag" ]; then
echo "Not enough tags found."
exit 1
fi
# Generate release notes from commits between the two latest tags
echo "Release Notes from $secondLastTag to $latestTag:"
git log "$secondLastTag".."$latestTag" --pretty=format:"%s" | grep -E 'feature:|fix:' | sort | uniq | sed -e 's/feature:/\nNew Feature:/g' -e 's/fix:/\nFix:/g'