Deploy to a different environment depending on the source branch

Viewed 232

I am trying to set environment in the Azure DevOps build pipeline conditionally based on the trigger branch.

I tried something like this:

jobs:
    - deployment: Deploy
      ${{ if eq(variables['Build.SourceBranch'], 'DEV') }}: 
        environment: DEV
      ${{ if eq(variables['Build.SourceBranch'], 'TEST') }}: 
        environment: TEST

however no luck.

Any ideas how to set it correctly?

1 Answers
Related