Created
March 13, 2017 13:04
-
-
Save Yago/e055c82a1c75eae31f349e46481ca712 to your computer and use it in GitHub Desktop.
Dynamically update Changelog.md base on commits since last tag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LASTDATE=$(git show -s --format=%ad `git rev-list --tags --max-count=1`) | |
echo $1 > VERSION | |
touch CHANGELOG.tmp | |
echo `date +"*$1* (%Y-%m-%d)"` >> CHANGELOG.tmp | |
COMMITS=`git log --pretty=format:" - %s (%h);" --since="$LASTDATE"` | |
index=0 | |
IFS=';' | |
for line in $COMMITS; do | |
read -r -p "$line [y/N] " response | |
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
SAVED[$index]=$line | |
fi | |
((index++)) | |
done | |
echo ${SAVED[@]} >> CHANGELOG.tmp | |
echo "" >> CHANGELOG.tmp | |
cat CHANGELOG.md >> CHANGELOG.tmp | |
mv CHANGELOG.tmp CHANGELOG.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment