Search code examples
azureazure-devopsazure-pipelinesazure-artifacts

How to update the version in azure devops pipeline


I am having the below task in my azure pipeline

- task: UniversalPackages@0
  displayName: 'Publish to Azure Artifact feed'
  inputs:
    command: 'publish'
    publishDirectory: '$(Build.SourcesDirectory)/abc'
    feedsToUsePublish: 'internal'
    vstsFeedPublish: 'xyz'
    vstsFeedPackagePublish: 'bundle'
    versionOption: 'custom'
    **versionPublish: '1.0.0'**
    publishedPackageVar: 'ReleaseBundle#1'

my question is

when the pipeline is automatically triggered, how can I update the value of versionPublish so that the artifact is stored in the feed with a new version


Solution

  • According to the UniversalPackages@0 task documentation, versionOption is used to specify a version increment strategy.

    Allowed values are the following:

    • major (Next major): the first version will be 1.0.0
    • minor (Next minor): the first version will be 0.1.0
    • patch (Next patch): the first version will be 0.0.1
    • custom: value to input your package version manually

    Values will be incremented automatically when using versionOption: major, versionOption: minor or versionOption: patch.

    You should only use versionOption: custom if you want to have full control over the way the version is generated, for example using the counter expression to construct an incremental version number.