this is my variable declaration section in azure-pipelines.yml, but at the moment even if the branchName is either prod or dev, the buildScript variable will be set from the else clause
What am I missing for the if/else clause to use the correct value?
variables:
npm_config_cache: '$(Pipeline.Workspace)/.npm'
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
branchName: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
branchName: $[ replace(variables['System.PullRequest.TargetBranch'], 'refs/heads/', '') ]
${{ if or(eq(variables['branchName'], 'prod'), eq(variables['branchName'], 'dev')) }}:
buildScript: 'npm run build:$(branchName)'
${{ else }}:
buildScript: 'npm run build'
