Skip to main content

Auto-tag GitLab and GitHub repos with semantic version tags — one tool, two strategies, two providers.

Project description

semvertag

CI codecov

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.1,<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 latest 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: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - run: pip install --quiet 'uv>=0.4,<1'
      - run: uvx 'semvertag>=0.3,<1' tag
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

semvertag auto-detects GitHub Actions from GITHUB_ACTIONS=true and creates the tag ref via the GitHub API. fetch-depth: 0 matters — the default 1 misses tag-relative history. See GitHub Actions docs for token scopes, GitHub Enterprise setup, and troubleshooting.

Strategies

  • branch-prefix (default): the latest commit on the default branch must be a merge commit whose source branch starts with feature/ (minor), bugfix/, or hotfix/ (patch).
  • conventional-commits: parses the latest commit's Conventional Commits header (feat: minor, fix:/perf: patch, ! or BREAKING CHANGE: major).

Both are configurable via env vars. See docs for the full configuration surface.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semvertag-0.3.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semvertag-0.3.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file semvertag-0.3.1.tar.gz.

File metadata

  • Download URL: semvertag-0.3.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.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}

File hashes

Hashes for semvertag-0.3.1.tar.gz
Algorithm Hash digest
SHA256 91e42de78cd5ebe94cdd68c027c0431118cd4e5deeb9b9e19c46685fd75502d8
MD5 7f0e4861d8ab79f336c2822b46e1f389
BLAKE2b-256 b4f8cd945c5922537ae3d3ff9e9341d7361c804a2055c12b65093f9c969995d8

See more details on using hashes here.

File details

Details for the file semvertag-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: semvertag-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.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}

File hashes

Hashes for semvertag-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c943b396ba0fbff68a1d1b9c9ae2e53648c54718db30012027f5c7616baea33e
MD5 4f73f57ad9b48eb436eb4cd7153de3dc
BLAKE2b-256 b03c5c7d850b59c03c6679240d366216ac9bd1bd0f4d3e619bd47581b383e77f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page