In todayβs fast-paced development environments, manually maintaining version numbers and generating changelogs can become a bottleneck. gitag is a modern, lightweight CLI tool designed to integrate seamlessly into your CI/CD pipeline, parsing Conventional Commits and applying Semantic Versioning automatically. Read on to learn how gitag can save you time β±οΈ, reduce human error β, and improve release consistency π.
π€ Why You Need Automatic Versioning
Maintaining consistent version numbers and comprehensive changelogs is challenging:
- Human Error β: Manual bumps can be forgotten or inconsistent, leading to mismatched tags.
- Inefficient Workflows π’: Time spent on versioning and changelog updates diverts focus from actual development.
- Poor Traceability π: Without clear semantic tags, itβs hard to understand which commits introduced features, fixes, or breaking changes.
By automating this process, gitag ensures:
- π Reliable Tags: Always follow Semantic Versioning (MAJOR.MINOR.PATCH).
-
π Consistent Changelogs: Automatically generate or update your
CHANGELOG.md
. - π€ Seamless CI/CD Integration: No manual stepsβjust push and let gitag handle the rest.
β¨ Key Features of gitag
Feature | Benefit |
---|---|
β Conventional Commits parsing | Detects feat: , fix: , BREAKING CHANGE: , and more |
π’ Semantic Versioning support | Automatic MAJOR, MINOR, PATCH bumps |
π Dry-Run & CI Modes | Preview changes before applying; perfect for pipelines |
π Changelog Generation (BETA) | Keeps your CHANGELOG.md in sync with commits |
βοΈ Configurable via pyproject.toml
|
Customize prefixes, merge strategies, and bump keywords |
π Merge Commit Strategies | Choose auto, always, or merge-only bump behavior |
π€ GitHub Actions Example | Out-of-the-box workflow provided for quick setup |
π§ͺ 100% Tested with pytest | Confidence in production usage |
π¦ Installation & Quickstart
- Install from PyPI
pip install gitag
- π Preview Next Tag (Dry-Run)
gitag --dry-run
- π Tag & Changelog in CI
gitag --ci --changelog
For development or contributions:
git clone https://github.com/henrymanke/gitag.git
cd gitag
pip install -e .[dev]
π§ How gitag Works
-
Analyze Commits π
Reads your Git history since the last tag, matching commit messages against Conventional Commits patterns (e.g.,
feat:
,fix:
,perf:
). - Determine Bump Level π
-
Major π₯:
BREAKING CHANGE:
,!:
-
Minor β¨:
feat:
orfeature(...)
-
Patch π:
fix:
,perf:
,docs:
,chore:
, etc.-
Generate Tag & Changelog π·οΈ
Applies the next semantic version tag (e.g.,
v1.2.3 β v1.3.0
), optionally updatesCHANGELOG.md
, andβif in CI modeβpushes tags to remote.
-
Generate Tag & Changelog π·οΈ
Applies the next semantic version tag (e.g.,
π€ Integrating with GitHub Actions
Add the following workflow to .github/workflows/auto-tag.yml
to automate tagging on every push to main
:
name: Auto Tag
on:
push:
branches: [main]
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: π₯ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: π Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: π¦ Install gitag
run: pip install gitag
- name: π Run gitag (CI + Changelog)
run: gitag --ci --debug --changelog
- name: π€ Upload CHANGELOG
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md
βοΈ Configuration Example
Customize gitag behavior via pyproject.toml
:
[tool.gitag]
prefix = "v"
merge_strategy = "auto"
[tool.gitag.bump_keywords]
major = ["BREAKING CHANGE", "!:"]
minor = ["feat:"]
patch = ["fix:", "perf:", "docs:", "chore:"]
See the full Config Reference for advanced options.
π Conclusion
By adopting gitag, you can:
- β Eliminate manual errors in version bumps
- β‘ Accelerate release cycles with automated tagging
- π Maintain clear changelogs aligned with your commit history
Start today by running:
gitag --dry-run
and transform your release process with robust, semantic versioning automation.
Happy tagging! π·οΈ
Top comments (1)
Hi, Nice posting!