Search code examples
azure-pipelinesgitversion

Why is the patch version not auto incrementing when using GitVersion?


I'm using Azure pipelines to set a version number using GitVersion. Here is the pipeline:

    - task: gitversion/setup@0
      displayName: 'Setup GitVersion'
      inputs:
        versionSpec: '5.x'
    
    - task: gitversion/execute@0
      displayName: 'Run GitVersion'
      inputs:
        useConfigFile: true
        configFilePath: 'GitVersion.yml'

It seems to run without any problems but the patch number is never incremented. It doesn't work when I add +semver: patch to the commit message either.

It seems the FullSemVer is affected: 0.8.0+11
But I'm expecting: 0.8.11

Here is the GitVersion.yml file

next-version: 0.7.0
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery
increment: Patch
continuous-delivery-fallback-tag: ci
tag-prefix: '[vV]'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: Enabled
commit-date-format: 'yyyy-MM-dd'
ignore:
  sha: []
merge-message-formats: {}

Thanks for any help.


Solution

  • It seems the FullSemVer is affected: 0.8.0+11

    When I use the ContinuousDelivery mode, I could get the same result.

    You could try to use the mainline mode in yml file.

    Here is my example: You could try to remove the next-version parameter

    mode: mainline
    tag-prefix: '[vV]'
    commit-message-incrementing: Enabled
    major-version-bump-message: '\+semver:\s?(breaking|major)'
    minor-version-bump-message: '\+semver:\s?(feature|minor)'
    patch-version-bump-message: '\+semver:\s?(fix|patch)'
    no-bump-message: '\+semver:\s?(none|skip)'
    assembly-informational-format: '{Major}.{Minor}.{Patch}' 
    

    Here is a doc about Gitversion Mainline mode.

    Result:

    enter image description here

    The patch will auto incremente