A tool for Generating Release Notes from Git Commits
· Ted
The problem
Like many coders I spend an inordinate amount of time generating release notes for builds. It's one of those tasks which just takes a couple of minutes, but do it over enough days and it soon adds up.
The solution
Recently I decided to take the mish mash of scripts I use and put them all into a nice reusable Ruby gem.
You can install it using the gem tool on the command line:
If using the system Ruby: sudo gem install releasenotes
Or via RVM: gem install releasenotes
You can then run the command releasenotes inside your git repository in one of two ways:
- Specify a commit manually:
releasenotes -c 3a0dd555553597c3eeba80f665d72a293a92fe84 - Give it your Hockey tokens to figure out the commit of your last build (you'll need a user token from your profile and an app token from your specific app page)
The output can then be piped into your system clipboard for pasting and sanitising:
releasenotes -c 3a0dd555553597c3eeba80f665d72a293a92fe84 | pbcopy
I tend to prefix each feature in a commit message with - so that I get a nice set of markdown ready bullet points at the end.
For example, running the tool [its own repository][1], specifying the first commit SHA1, as above will produce:
- updated homepage of the tool
- updated author name
538087778470dcdfc05a8f5772e889e86d3b6f82
Hockey integration
The Hockey integration relies on each builds release notes containing somewhere the SHA1 of the last commit. You can get things started there by doing one last set of release notes by hand and putting the SHA1 in there. You can find it with the command git log | head -n1.
Each set of release notes the tool generates from then on will have the most recent commit at the bottom of the list so you won't have to worry about that from then on.
How it works
Internally the gem just runs git log and then runs it through some filters to strip out blank lines, authors, commit numbers and other jetsam.
The Hockey aspects make use of the API which HockeyApp detail [here][2].
The code is all freely available [on GitHub][3]. I'd love to hear about any modifications or extensions people make to it!
[1]: https://github.com/earltedly/releasenotes [2]: http://support.hockeyapp.net/kb/api [3]: https://github.com/earltedly/releasenotes