Skip to content

Commit

Permalink
use conditional variables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmrdavid committed Jan 5, 2024
1 parent d16f78a commit a5f6806
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a5f6806

Please sign in to comment.