0

I use GitTools for auto increment semVer.

The current version: v1.1.1
calculate SemVer:
"MajorMinorPatch": "1.2.0"

when incrementing the patch:
git commit -a -m "+semver: patch [skip azurepipelines]" --allow-empty
Write-Host "$(GitVersion.SemVer)"
print > "MajorMinorPatch": "1.2.0"

which I expect:
"MajorMinorPatch": "1.2.1"

more example
when incrementing the minor:
git commit -a -m "+semver: minor [skip azurepipelines]" --allow-empty
Write-Host "$(GitVersion.SemVer)"
print > "MajorMinorPatch": "1.2.0"

which I expect:
"MajorMinorPatch": "1.3.0"

Metin Bulak
  • 537
  • 4
  • 8
  • 30

1 Answers1

0

You need to run the script: git commit -a -m "+semver: minor [skip azurepipelines]" --allow-empty before the Execute GitVersion Task.

Then the Git Tools task will update the version value. Otherwise, the execute task will not be able to read your commit information.

Here is an example:

steps:
- task: gitversion/setup@0
  displayName: gitversion/setup
  inputs:
    versionSpec: 5.x

- powershell: |
   
   git commit -a -m "+semver: minor [skip azurepipelines]" --allow-empty
   


- task: gitversion/execute@0
  displayName: gitversion/execute
  inputs:
    useConfigFile: true
    configFilePath: test.yml

- powershell: |
   
   Write-Host "$(GitVersion.SemVer)"
Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28