A release helper
The problem
Build a tool that reads the conventional commit messages since the last release, chooses the next version number, and writes a changelog entry.
Requirements
- Parse commit messages of the form type(scope): description and reject invalid ones
- Choose the next version with the rules of semantic versioning, including breaking changes
- Group the changes into Added, Fixed and Changed sections of a changelog entry
- Sort a list of versions correctly, including pre-releases
Technologies
- Python 3
- String methods
- Dictionaries
- Sorting with key functions
Step by step
- Write the commit parser and test it with valid and invalid messages.
- Write the function that picks the bump from the set of change kinds.
- Write the changelog builder that groups the descriptions under headings.
- Run the whole helper on a sample history and check the result by hand.
Expected result
A program that prints the next version and a ready-to-paste changelog section.
How it is evaluated
- Breaking changes always give a major bump
- Versions compare as numbers, not as text
- The changelog is grouped and readable for users
- Invalid messages are reported and not silently skipped
Ways to improve it
- Add the date and links to issues in the entry
- Support 0.x versions with their own rule
- Write the entry to a CHANGELOG.md file