From a5f6806b8d87025c7f0ed516872bac03ae0d07e7 Mon Sep 17 00:00:00 2001 From: David Justo Date: Fri, 5 Jan 2024 13:51:25 -0800 Subject: [PATCH] use conditional variables --- azure-pipelines-release.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index d6e4d0225..6dc866632 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -7,22 +7,17 @@ pool: - ImageOverride -equals MMS2022TLS variables: - PackageSuffix: '' -steps: + - name: PackageSuffix + # if source branch is not `dev` then we're generating a release based on a feature branch + # In that case, we populate the environment variable "PackageSuffix" accordingly + ${{ if ne(variables['Build.SourceBranchName'], 'dev') }}: + value: 'pr.$(Build.BuildNumber)' # the "pr" section is to denote this code is a candidate to be PR'ed + ${{ else }}: + value: '' -- task: PowerShell@2 - displayName: 'Populate PackageSuffix iff source branch is not dev' - inputs: - targetType: 'inline' - script: | - # if source branch is not `dev` then we're generating a release based on a feature branch - # In that case, we populate the environment variable "PackageSuffix" accordingly - if($Env:BUILD_SOURCEBRANCHNAME -ne 'dev'){ - # the "pr" section is to denote this code is a candidate to be PR'ed - $versionSuffix = "pr.$(Build.BuildNumber)" - Write-Host "##vso[task.setvariable variable=PackageSuffix;]$versionSuffix" - } + +steps: # Configure all the .NET SDK versions we need - task: UseDotNet@2