I'm using the counter
function in Azure Pipelines to generate the version patch, allowing me to get an autoincremented version number as part of my CI/CD.
version.major: 4
version.minor: 2
version.patch: $[counter(format('{0}.{1}', variables['version.major'], variables['version.minor']), 0)]
version.full: $[format('{0}.{1}.{2}', variables['version.major'], variables['version.minor'], variables['version.patch'])]
However, I now need this version counter to be shared between two pipelines in the same repository. One of the pipelines publishes some packages, whilst the other deploys some resources. I'd like the pipelines to be separate since sometimes one would need to be run without the other – for example, because they're triggered for different path filters. However, I would like them both to contribute to the same versioning sequence – I don't want my packages to have version numbers disparate from the resources.
Is there a way of achieving this shared versioning sequence? I've already tried variable reuse, but the counter
gets evaluated in the outer pipeline, not the inner template where it's defined.