Skip to content

Instantly share code, notes, and snippets.

@tricinel
Created April 3, 2017 11:37
Show Gist options
  • Save tricinel/b4f74e7875b632d0bd1cd8e81c50a462 to your computer and use it in GitHub Desktop.
Save tricinel/b4f74e7875b632d0bd1cd8e81c50a462 to your computer and use it in GitHub Desktop.
#!/bin/bash
filename='NOTES.md'
format='
r=%(refname)
currenttag=${r#refs/tags/}
prevtag=$(git describe --always --tags --abbrev=0 ${currenttag}^)
changes=$(git log --no-walk ${prevtag}...${currenttag} --pretty=format:"* %s" | awk "!(/Bump/ || /Merge/ || /Build/ || /Release/ || /#nochangelog/)")
echo -e "###${currenttag}\n___\n\n${changes}\n\n$(cat ${filename})" > ${filename}
'
echo -e "###${currenttag}\n___\n\n${changes}\n\n" > ${filename}
echo "----> Creating release notes in ${filename}."
eval=`git for-each-ref --shell --format="$format" \
--sort='*objecttype' \
--sort=taggerdate \
refs/tags`
eval "$eval"
echo "----> Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment