From 5622318e912cb53d0e956af438eef5087ae6b2e7 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Thu, 3 Oct 2019 13:27:13 +0200 Subject: [PATCH] new: added changelog script --- scripts/changelog.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 scripts/changelog.sh diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 0000000..1c2f28a --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +NEW=() +FIXES=() +MISC=() + +echo "@ Fetching remote tags ..." +git fetch --tags >/dev/null +printf "\n\n" + +CURTAG=$(git describe --tags --abbrev=0) +OUTPUT=$(git log $CURTAG..HEAD --oneline) +IFS=$'\n' LINES=($OUTPUT) + +for LINE in "${LINES[@]}"; do + LINE=$(echo "$LINE" | sed -E "s/^[[:xdigit:]]+\s+//") + if [[ $LINE == *"new:"* ]]; then + LINE=$(echo "$LINE" | sed -E "s/^new: //") + NEW+=("$LINE") + elif [[ $LINE == *"fix:"* ]]; then + LINE=$(echo "$LINE" | sed -E "s/^fix: //") + FIXES+=("$LINE") + elif [[ $LINE != *"i did not bother commenting"* ]] && [[ $LINE != *"Merge "* ]]; then + echo " MISC LINE =$LINE" + LINE=$(echo "$LINE" | sed -E "s/^[a-z]+: //") + MISC+=("$LINE") + fi +done + +if [ -n "$NEW" ]; then + echo + echo "**New Features**" + echo + for l in "${NEW[@]}"; do + echo "* $l" + done +fi + +if [ -n "$FIXES" ]; then + echo + echo "**Fixes**" + echo + for l in "${FIXES[@]}"; do + echo "* $l" + done +fi + +if [ -n "$MISC" ]; then + echo + echo "**Misc**" + echo + for l in "${MISC[@]}"; do + echo "* $l" + done +fi + +echo