docs-onboarding/resources/scripts/release-notes.bash

24 lines
750 B
Bash

#!/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'