GitVersion Tag Action
Automated semantic versioning and Git tagging based on your repository's commit history and branching strategy.
The Problem
Manual version management doesn't scale. Developers forget to update version numbers, create inconsistent tags, or use arbitrary versioning schemes that don't reflect the actual changes. When you're releasing multiple times a day across dozens of projects, manual versioning becomes a bottleneck and a source of errors.
GitVersion solves this by calculating semantic versions from your Git history. But you still need to integrate it into your CI/CD pipeline, configure it correctly, and ensure tags get pushed back to the repository. Setting this up repeatedly across projects is tedious.
The Solution
This action automates the entire GitVersion workflow for GitHub Actions. It installs GitVersion, calculates the semantic version based on your Git history and configuration, tags the repository, and pushes the tag to the origin. Other actions in your workflow can then use the calculated version via outputs.
Push code to your main branch, and the repository gets automatically tagged with the correct semantic version.
Key Capabilities
- Automatic version calculation: GitVersion analyzes your Git history to determine the next version
- Repository tagging: Automatically creates and pushes Git tags with commit message annotations
- Workflow integration: Exposes version as output for other actions to use
- Configurable: Supports custom GitVersion configurations for different branching strategies
Quick Example
- name: Tag repository
id: gitversion
uses: michielvha/gitversion-tag-action@v5
with:
configFilePath: 'gitversion.yml'
- name: Use version in another action
uses: some-action@v1
with:
version: ${{ steps.gitversion.outputs.semver }}The action calculates the version, tags the repo, and makes the version available for downstream steps.
Why This Matters
This is foundational for the other actions in this suite. The Docker, Go, and PowerShell actions all consume the version calculated by this action. Consistent versioning across all artifact types, all calculated from the same Git history.
The real value is consistency. Every project using this action follows the same versioning strategy. Developers don't need to remember versioning rules or manually create tags. The Git history becomes the source of truth for versions.
Learn More About GitVersion
For a detailed explanation of GitVersion concepts, configuration options, and best practices, check out my comprehensive GitVersion blog post. It covers semantic versioning strategies, conventional commits, and how to set up GitVersion for trunk-based development.
For usage examples and GitHub Actions integration, see the GitHub repository.
