diff --git a/documentation-guidelines.md b/documentation-guidelines.md index ff92fd6..4bee5c4 100644 --- a/documentation-guidelines.md +++ b/documentation-guidelines.md @@ -2,6 +2,23 @@ Best practices and guidelines for writing code documentation. +## Release Notes + +The idea is to get rather automated release notes. To have this as easy as possible, we need: + +- key words for the kind of change we applied: + - `feature:` - for newly added functionality + - `fix:` - for bugfixes + - `nonotes:` - for git commits we don't want to see in the release notes + +- tags for each version, we will output only the change log from the last and second last tag + +[resources/scripts/release-notes.bash](resources/scripts/release-notes.bash) is an example bash script to generate the release notes. You can run it with the following command: + +```bash +bash resources/scripts/release-notes.bash +``` + ## PlantUML Create png images from PlantUML files using the following command: diff --git a/resources/scripts/release-notes.bash b/resources/scripts/release-notes.bash new file mode 100644 index 0000000..5bd5720 --- /dev/null +++ b/resources/scripts/release-notes.bash @@ -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'