I am using GitVersion with Github Actions with main branch.
When a new tag is pushed to main branch, e.g. v2.0.0, I want to increase the patch:
2.0.0, 2.0.1, 2.0.2, ...
I have the following Github workflow:
name: Project
on:
push:
branches: [ main ]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versioning.outputs.semVer }}
name: setup
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: GitVersion
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: '5.x'
- name: Versioning
uses: gittools/actions/gitversion/execute@v1
id: versioning
build:
// Remaining workflow code
And I also have the gitversion.yml settings file:
mode: Mainline
branches:
main:
regex: ^main$
mode: Mainline
increment: Patch
is-mainline: true
And this is where the files are located in my project root:
Question
I pushed the tag v2.0.0 and after it I pushed the code to main branch.
The first version I got was 2.0.1 but every new push keeps producing version 2.0.1.
Why is patch not being incremented at every push to main branch?

Looking at the latest , try a setup with GitVersion 6, just to see if the issue persists there.
You can also ask GitVersion to print the version for the build, and to show the effective configuration for GitVersion: that can help confirm your configuration is correctly taken into account (or ignored, which could explain why your version does not change):
(See more at "Execute GitVersion Action (gitversion/execute) usage Examples")
For instance, the default name of the GitVersion config file is
GitVersion.yml. Yours isgitversion.yml. The case difference might be an issue, hence the suggestion to use/showConfig.