2024-05-12 13:34:47 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Check for the "final" flag in command line arguments
|
|
|
|
|
finalFlag=false
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
|
if [[ "$arg" == "final" ]]; then
|
|
|
|
|
finalFlag=true
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2024-05-12 13:34:47 +02:00
|
|
|
# Get tags sorted by creation date
|
|
|
|
|
tags=$(git tag --sort=creatordate)
|
|
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Convert tags into an array
|
2024-05-12 13:46:11 +02:00
|
|
|
if [[ $(echo "$BASH_VERSION" | cut -d. -f1) -ge 4 ]]; then
|
|
|
|
|
readarray -t tagArray <<< "$tags"
|
|
|
|
|
else
|
|
|
|
|
IFS=$'\n' read -d '' -ra tagArray <<< "$tags"
|
|
|
|
|
fi
|
2024-05-12 13:34:47 +02:00
|
|
|
|
2024-05-12 13:46:11 +02:00
|
|
|
# Determine the number of tags
|
2024-05-12 13:34:47 +02:00
|
|
|
len=${#tagArray[@]}
|
|
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Find the last tag or the last "final" tag based on the flag
|
|
|
|
|
if $finalFlag; then
|
|
|
|
|
for (( i=len-1; i>=0; i-- )); do
|
|
|
|
|
if [[ "${tagArray[i]}" == *"final"* ]]; then
|
|
|
|
|
latestTag="${tagArray[i]}"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if [ -z "$latestTag" ]; then
|
|
|
|
|
echo "No 'final' tag found."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-05-12 13:46:11 +02:00
|
|
|
else
|
2024-05-13 10:13:47 +02:00
|
|
|
if [ "$len" -gt 0 ]; then
|
|
|
|
|
latestTag="${tagArray[$len-1]}"
|
|
|
|
|
else
|
|
|
|
|
echo "No tags found."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-05-12 13:34:47 +02:00
|
|
|
fi
|
|
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Print release notes
|
2024-05-12 13:46:11 +02:00
|
|
|
echo ""
|
2024-05-13 10:13:47 +02:00
|
|
|
echo "Release Notes from $latestTag to HEAD:"
|
2024-05-12 13:46:11 +02:00
|
|
|
echo ""
|
|
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Fetch commit logs from the latest tag to HEAD and categorize them
|
|
|
|
|
newfeatures=$(git log "$latestTag"..HEAD --pretty=format:"%s" | grep 'new:' | sed 's/new:/* /g' | sort | uniq)
|
|
|
|
|
updatedfeatures=$(git log "$latestTag"..HEAD --pretty=format:"%s" | grep 'update:' | sed 's/update:/* /g' | sort | uniq)
|
|
|
|
|
fixedfeatures=$(git log "$latestTag"..HEAD --pretty=format:"%s" | grep 'fix:' | sed 's/fix:/* /g' | sort | uniq)
|
|
|
|
|
deletedfeatures=$(git log "$latestTag"..HEAD --pretty=format:"%s" | grep 'delete:' | sed 's/delete:/* /g' | sort | uniq)
|
2024-05-12 13:46:11 +02:00
|
|
|
|
2024-05-13 10:13:47 +02:00
|
|
|
# Output formatted commit lists
|
2024-05-12 13:46:11 +02:00
|
|
|
echo "New Features:"
|
2024-05-13 09:46:03 +02:00
|
|
|
if [ -z "$newfeatures" ]; then
|
2024-05-13 10:13:47 +02:00
|
|
|
echo "* No new features."
|
2024-05-13 09:46:03 +02:00
|
|
|
else
|
|
|
|
|
echo "$newfeatures"
|
|
|
|
|
fi
|
2024-05-12 13:46:11 +02:00
|
|
|
echo ""
|
2024-05-13 09:46:03 +02:00
|
|
|
|
|
|
|
|
echo "Updated Features:"
|
|
|
|
|
if [ -z "$updatedfeatures" ]; then
|
2024-05-13 10:13:47 +02:00
|
|
|
echo "* No updated features."
|
2024-05-13 09:46:03 +02:00
|
|
|
else
|
|
|
|
|
echo "$updatedfeatures"
|
|
|
|
|
fi
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
echo "Fixed Features:"
|
|
|
|
|
if [ -z "$fixedfeatures" ]; then
|
2024-05-13 10:13:47 +02:00
|
|
|
echo "* No fixed features."
|
2024-05-13 09:46:03 +02:00
|
|
|
else
|
|
|
|
|
echo "$fixedfeatures"
|
|
|
|
|
fi
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
echo "Deleted Features:"
|
|
|
|
|
if [ -z "$deletedfeatures" ]; then
|
2024-05-13 10:13:47 +02:00
|
|
|
echo "* No deleted features."
|
2024-05-13 09:46:03 +02:00
|
|
|
else
|
|
|
|
|
echo "$deletedfeatures"
|
|
|
|
|
fi
|
2024-05-12 13:46:11 +02:00
|
|
|
echo ""
|