Reputation: 11
I have a build pipeline on Azure DevOps that creates a package when the build runs successfully.
I would like to change behavior if the build is run from another git branch, for example when we run it from master build a release package but when we run it from a dev or feature branch release a prerelease package.
I think I will need to use variables and some condition checks?
Upvotes: 0
Views: 477
Reputation: 41755
You can check the predefined variable Build.SourceBranch
and use a custom condition in the package task:
steps:
- task: Create a release package
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: Create a pre-release package
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
Upvotes: 1