1 year ago

#146635

test-img

sommmen

GitVersion for Github flow

I want to auto version my c# projects using GitVersion. We're mainly using Github flow where our master branch is always 'buildable' and we deploy this directly.

  • Fixes (patch++) are commits directly on master or coming from any other branch (hotfix/ fix/ production/ etc)
  • Features (minor++) always have a feature branch (feature/) and are merged into master via a PR.

A rough sketch of what i want is something like this:

enter image description here

I'm having trouble with setting up the configuration for this. I tried doing something like this:

mode: Mainline
branches: 
  master:
    regex: ^master$|^main$
    increment: Patch
  feature:
    regex: ^[fF]eature?[/-]
    source-branches: ['master', 'feature']
    increment: Minor
ignore:
  sha: []
merge-message-formats:
  tfs: '^Merged PR (?<PullRequestNumber>\d+): '

But that gave me weird results:

  • 1.196.0 on master (i assume this'd be every commit done on the master branch). This is wrong since this should be something like 1.. but it seems the minor version is never incremented
  • 1.8.0-GitVersionMSBuild.2 when i moved this into a feature branch. I'm clueless as to where the minor version 8 comes from.

I also tried tagging the first commit of the repo as 1.0.0.

How should i change my configuration to support my flow?

c#

git

gitversion

0 Answers

Your Answer

Accepted video resources