Set up semantic release
In this MR I propose to set up the semantic releases using python-semantic-release
.
This tool enables detection of the next version to release making use of conventional commits. To profit from that we may e.g.:
- prefix all the commits with e.g.
fix:
(bumpspatch
),feat:
(bumpsminor
); see here for more details - modify only the merge commit messages, by adding the relevant prefix
- use commitizen precommit hook in the follow-up MR
I've added a release
CI job which runs only when manually triggered (we may think of other options), which does the following:
- checks if the
RELEASE_TYPE
CI variable is set tomajor
,minor
, orpatch
. If yes, it forces the update of the version according to the chosen type, ignoring the version bump determined from commit messages - if
RELEASE_TYPE
is set to something else (by default to--noop
) it checks ifpython-semantic-release
tool detects the new version, and chooses it if so - it runs
semantic-release publish
which updates the changelog, version inpyproject.toml
, creates a tag and pushes it to GitLab (optionally uploads to PyPI)
To use that, one also needs to setup GitLab token and add GL_TOKEN
variable.
Edited by Maciej Pawel Szymanski