Version number counter for Azure DevOps

2 minute read

This week I released a new extension for Azure Pipelines called Version number counter. With this extension you add the ability to auto increment a version number for for example a build or release.

Features

Keys features of this extension are:

  • Auto increment patch version number.
  • Ability to manually change the version number.
  • Auto increment major version number when a maximum number for the minor version is specified.
  • Specify a maximum value for the patch, minor or major version number.
  • Auto increment minor version number when a maximum number for the patch version is specified.

Azure DevOps - Version number counter

Configuration

The extension can be found in the Azure DevOps marketplace (https://marketplace.visualstudio.com/items?itemName=maikvandergaag.maikvandergaag-versioncounter). When installed you can find it in a release or build pipeline under the name "Version number counter".

search version number

For the configuration of the extension there are two main parameters you need to set:

  • The saved version variable: This parameters is the name of the variable you use to save the version number. This variable will be incremented on each build. This variable can also be used as for example the build number. The saved version number needs to be in the format: *.*.*
  • Azure DevOps Personal Access Token: A personal access token for an account that can update build of releases. When using the extension within a build or release pipeline you need to supply a personal access token with the appropriate amounts of rights:
    • For using it within a build: Build: Read & Execute
    • For using it within a release: Release: Read, write and execute

Required Permissions - PAT

Adding a personal access token to your build or release pipeline is only secure when you use the Azure Keyvault. Somewhat less secure is using a secure variable

Build variables

When you need to auto increment the minor or major version number you need to check the check box: "Automatically update minor number" or "Automatically update major number". When checked the options to insert the maximum patch / minor version number will appear.

For example fill in 9 as the maximum patch number 1.0.9 will be incremented to 1.1.0.

When you configure the variable with the version number as your build number format this number will be incremented with nicely with each build or release.

Build Properties

Builds