Skip to main content

semvertag

PyPI version Supported Python versions Downloads Coverage CI License GitHub stars Context7 uv Ruff ty

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.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 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_di container (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.

📚 Documentation

📦 PyPI

📝 License

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.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semvertag 0.9.0
File Size Uploaded
semvertag-0.9.0.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for semvertag 0.9.0
File Interpreter ABI Platform
semvertag-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.5 kB

Release files / semvertag-0.9.0.tar.gz

Download URL semvertag-0.9.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dd0d2cb39c4e3e2caf4df0e83c0b9ce59312c132b3b9ced1538762067d9f6846
BLAKE2b-256 checksum
How to use checksums
3d8e21bac0ca8820d39fdb23aaf8345383e8f95e0c616dcf56569f59b3555173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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.9.0-py3-none-any.whl

Download URL semvertag-0.9.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ed22558f2570e0aed51781381099fa1affb865842111ae9259472ce0f8d883a
BLAKE2b-256 checksum
How to use checksums
13af2b905100154c7a34254ecdb7ce25d6be46ee1b053b5458502fef44f63f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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 history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page