Skip to content

Set up semantic release

Maciej Pawel Szymanski requested to merge maszyman-semantic-release into master

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: (bumps patch), feat: (bumps minor); 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 to major, minor, or patch. 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 if python-semantic-release tool detects the new version, and chooses it if so
  • it runs semantic-release publish which updates the changelog, version in pyproject.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

Merge request reports