Automating release log
3 min read

Automating release log

Time and time again the dreaded question marches your way - what is actually going out in the next release? There is multiple ways you can handle that, below are some of my favourites:

  1. Grep git differences - most people ask me why would I ever need it if half of the version control system is spitting out the differences on merge requests.  Not sure where besides the following - when we were working with GitLab (or another tool)  which doesn't have proper integration with you ticketing system. This little script allowed us to move tickets from:
    to-do -> in progress
    review -> test
    test -> done / deployed
    relatively automagically.
git log --pretty=format:'%s' --date=relative origin/prod..HEAD | grep -e '{project_id}-[0-9]\{1,4\}' -ioh

# git log --pretty=format:'%s' --date=relative origin/{merge_target}..{source / current HEAD} | grep -e '{project_name}-[0-9]\{1,4\}' -ioh
It can even filter out the tickets that are part of the release if you're using some PR/merge formatting!

2. Automatic changelog - more useful for packages, binaries and libraries in my opinion. Again requires using a version of conventional commits, but is highly configurable. In short what you do is follow the principles described in and then output it with

 conventional-changelog -i -s -r 0
the -r 0 is actually for starting from commit one if you haven't done any of that before

it will output a nice document for you, along the lines of:

It can be easily incorporated in your toolchain - either with husky or git-commit hooks (well, you can write them yourself if you wish as well) or into your CI processes. This way you can easily enforce the formatting, making sure everyone on the team complies with the required structure.

lint's output when you're not following the the pattern matching (also adjustable)

Some good resources to use when working conventional commits / semantic changelog:

Conventional Commits
A specification for adding human and machine readable meaning to commit messages
📓 Lint commit messages. Contribute to conventional-changelog/commitlint development by creating an account on GitHub.
Generate changelogs and release notes from a project’s commit messages and metadata. - conventional-changelog/conventional-changelog

Happy to hear about other tools you use to automate some of the boring & repetitive aspects of what we do!