Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

Commit

Permalink
tools: Added script to generate changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ashcrow authored and mbarnes committed Feb 28, 2017
1 parent eeafc34 commit d92fafd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tools/gen-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
#
# Generates a changelog for a release

set -euo pipefail

if [ $# -ne 2 ]; then
echo "You must provide the repo directory and the previous tag."
echo "Example: ./tools/gen-changelog.sh . 0.0.0"
exit 1
fi

REPODIR=$1
LASTTAG=$2
NEWCHANGELOG=`mktemp`

pushd $REPODIR
VERSION=`python setup.py --version`
echo "# `basename $PWD` v$VERSION" >> $NEWCHANGELOG
echo '```' >> $NEWCHANGELOG
git log $LASTTAG..HEAD --pretty="* %h: %s" >> $NEWCHANGELOG
echo '```' >> $NEWCHANGELOG
if [ -e CHANGELOG.md ]; then
echo "" >> $NEWCHANGELOG
cat CHANGELOG.md >> $NEWCHANGELOG
fi
mv $NEWCHANGELOG CHANGELOG.md
rm -f $NEWCHANGELOG
popd

0 comments on commit d92fafd

Please sign in to comment.