Auto-tag your GitLab or GitHub repository with semantic version tags from CI. One tool covers both providers and offers two bump strategies.
Install
uvx semvertag tag
semvertag bumps from the highest existing semver tag and never creates
the first one. Before the first run, create a semver tag such as
0.1.0, or v0.1.0 if you want v-prefixed tags: each new tag keeps
the prefix of the one it bumps from.
Use it in GitLab CI
Paste this job into your .gitlab-ci.yml:
stages: [tag]
semvertag:
stage: tag
image: python:3.13-slim
variables:
SEMVERTAG_STRATEGY: branch-prefix # or: conventional-commits
before_script:
- pip install --quiet 'uv>=0.4,<1'
script:
- uvx 'semvertag>=0.10.0,<1' tag
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
It runs uvx semvertag tag against your repo on the default branch.
semvertag inspects the head commit and the tag history, decides the
semver bump, and creates the new tag through the GitLab API.
A one-line
include: - component: …via the GitLab CI Catalog will replace this snippet once the component is published. For now, paste the job inline.
Use it in GitHub Actions
Paste this workflow into .github/workflows/semvertag.yml:
name: semvertag
on:
push:
branches: [main]
permissions:
contents: write
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: modern-python/semvertag@v0
semvertag auto-detects GitHub Actions, picks the bump from the latest
commit, and creates the tag ref via the GitHub API. It never reads the
working tree, so the job needs no actions/checkout step at all. See
GitHub Actions docs for token scopes,
GitHub Enterprise setup, outputs, and troubleshooting.
Strategies
The default branch-prefix strategy requires the head commit on the
default branch to be a merge commit whose subject names a feature/
(minor), bugfix/, or hotfix/ (patch) branch.
The conventional-commits strategy parses the head commit's
Conventional Commits
header (feat: minor, fix:/perf: patch, ! or BREAKING CHANGE: major).
Both are configurable through environment variables. See docs for the full configuration surface.
Built with
semvertag stands on other modern-python libraries:
- modern-di-typer wires
dependency injection into the Typer CLI. semvertag resolves its
settings, API providers, and bump strategies through a
modern_dicontainer (semvertag/ioc.py). - httpware is the HTTP client both providers use for the GitLab/GitHub REST calls. It handles retries, timeouts, typed decoding, and secret redaction.
Links
Part of modern-python
Browse the full list of templates and libraries in
modern-python. The org profile has the categorized index.
Metadata
Release files for semvertag 0.11.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| semvertag-0.11.1.tar.gz | 18.6 kB | Without provenance | Details for semvertag-0.11.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| semvertag-0.11.1-py3-none-any.whl | Python 3 | none | any | Details for semvertag-0.11.1-py3-none-any.whl |
Total release size: 44.0 kB
Release files / semvertag-0.11.1.tar.gz
| Download URL | semvertag-0.11.1.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ffb0d45b26804249b36589ecb03e62d1138d3d8d30542f435b06a14f09ac9ac
|
|
BLAKE2b-256 checksum How to use checksums |
6258b386d3c458446bfc1c52735a38e45560dea4e2c163dc815c11c7531aea21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / semvertag-0.11.1-py3-none-any.whl
| Download URL | semvertag-0.11.1-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
069029aa0fe5f999a656989e6f1641efc24117db2a299fdb0b16a62b34fd4a75
|
|
BLAKE2b-256 checksum How to use checksums |
6b4c33d7c9042a5c5e0ee9029874b5e5a7e1a668220125adb1613d635195dfa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for semvertag 0.11.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.