Skip to content

Instantly share code, notes, and snippets.

@jsenin
Created May 19, 2020 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsenin/f1ff46b4c7ec73caa840896228daa7f1 to your computer and use it in GitHub Desktop.
Save jsenin/f1ff46b4c7ec73caa840896228daa7f1 to your computer and use it in GitHub Desktop.
Update CHANGELOG adding all previous commits subject by default
#!/bin/bash
current_tag=production_$(date +'%Y%m%d')
git tag $current_tag
previous_tag=$(git tag -l 'prod*' --sort=-committerdate | grep -v $current_tag | head -n1)
commit_description=$(git log $previous_tag..$current_tag --pretty=format:" * %s")
if ! [ -f CHANGELOG.md ]; then touch CHANGELOG.md; fi;
cat << EOF > CHANGELOG.md
${current_tag}
===================
${commit_description}
$(cat CHANGELOG.md)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment