Auto-tag your GitLab or GitHub repository with semantic version tags from CI — one tool, two strategies, two providers.
Install
uvx semvertag tag
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.5.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 + tag history, decides the
appropriate semver bump, and creates the new tag via 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
- branch-prefix (default): the head commit on the default branch
must be a merge commit whose source branch starts with
feature/(minor),bugfix/, orhotfix/(patch). - conventional-commits: parses the head commit's
Conventional Commits
header (
feat:minor,fix:/perf:patch,!orBREAKING CHANGE:major).
Both are configurable via env vars. See docs for the full configuration surface.
Built with
semvertag stands on other modern-python libraries:
- modern-di-typer —
dependency-injection wiring for the Typer CLI. semvertag resolves its
settings, API providers, and bump strategies through a
modern_dicontainer (semvertag/ioc.py). - httpware — the resilient HTTP client both providers use for the GitLab/GitHub REST calls (retries, timeouts, typed decoding, secret redaction).
📚 Documentation
📦 PyPI
📝 License
Part of modern-python
Browse the full list of templates and libraries in
modern-python — see the org profile for the categorized index.
Metadata
Release files for semvertag 0.8.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| semvertag-0.8.5.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| semvertag-0.8.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / semvertag-0.8.5.tar.gz
| Download URL | semvertag-0.8.5.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b678159026dbbbe82a42b38e7587db2e4b3163bf8651647e8f984b94f8c7467b
|
|
BLAKE2b-256 checksum How to use checksums |
84d8a202919c1c07edcab7811f76663c060201f3b4b9194d12c8c15291478374
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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.8.5-py3-none-any.whl
| Download URL | semvertag-0.8.5-py3-none-any.whl |
|---|---|
| Size | 24.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73fe999206bdd1afe88f84269b89654214e62ecd00f432ef85136431b3caf7c5
|
|
BLAKE2b-256 checksum How to use checksums |
a83c0464319c34f94f0def12c7956b084d9cb6e58f789ad745b8d50e23ed375b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|