|
10 | 10 | strategy:
|
11 | 11 | matrix:
|
12 | 12 | linux:
|
13 |
| - imageName: 'ubuntu-latest' |
| 13 | + imageName: 'MMSUbuntu20.04TLS' |
14 | 14 | windows:
|
15 |
| - imageName: 'vs2017-win2016' |
| 15 | + imageName: 'MMS2019TLS' |
16 | 16 |
|
17 | 17 | pool:
|
| 18 | + name: '1ES-Hosted-AzFunc' |
18 | 19 | vmImage: $(imageName)
|
19 | 20 |
|
20 | 21 | variables:
|
21 | 22 | Configuration: Release
|
22 | 23 | buildNumber: $[ counter('build', 400) ] # Start higher than our AppVeyor versions. Every build (pr or branch) will increment.
|
23 | 24 |
|
24 | 25 | steps:
|
| 26 | +- pwsh: | |
| 27 | + $releaseBranches = @('v4.x/ps7.2', 'v4.x/ps7.0', 'v3.x/ps7', 'v3.x/ps6', 'v2.x') |
| 28 | +
|
| 29 | + Write-Host "BuildSourceBranch: $($env:BuildSourceBranch)" |
| 30 | + $branchName = $env:BuildSourceBranch.Replace("refs/heads/", "") |
| 31 | + Write-Host "BranchName: $branchName" |
| 32 | +
|
| 33 | + $isReleaseBuild = ($releaseBranches -contains $branchName) |
| 34 | + Write-Host "##vso[task.setvariable variable=IsReleaseBuild]$isReleaseBuild" |
| 35 | + Write-Host "IsReleaseBuild: $isReleaseBuild" |
| 36 | + displayName: 'Set IsReleaseBuild variable' |
| 37 | + env: |
| 38 | + BuildSourceBranch: $(Build.SourceBranch) |
| 39 | + |
25 | 40 | - pwsh: ./build.ps1 -NoBuild -Bootstrap
|
26 | 41 | displayName: 'Running ./build.ps1 -NoBuild -Bootstrap'
|
27 | 42 |
|
28 | 43 | - pwsh: |
|
29 | 44 | $ErrorActionPreference = "Stop"
|
30 |
| - ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" |
| 45 | + if ($isReleaseBuild) |
| 46 | + { |
| 47 | + ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" -AddSBOM -SBOMUtilSASUrl $env:SBOMUtilSASUrl |
| 48 | + } |
| 49 | + else |
| 50 | + { |
| 51 | + ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" |
| 52 | + } |
31 | 53 | displayName: 'Build worker code'
|
| 54 | + env: |
| 55 | + SBOMUtilSASUrl: $(SBOMUtilSASUrl) |
32 | 56 |
|
33 | 57 | - pwsh: ./build.ps1 -NoBuild -Test
|
34 | 58 | displayName: 'Running UnitTest'
|
@@ -57,18 +81,8 @@ steps:
|
57 | 81 | TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
58 | 82 | displayName: 'Copy package to artifacts directory'
|
59 | 83 |
|
60 |
| -- pwsh: | |
61 |
| - $uploadPackage = $null |
62 |
| - if (-not ([bool]::TryParse($env:UPLOADPACKAGETOPRERELEASEFEED, [ref] $uploadPackage))) |
63 |
| - { |
64 |
| - throw "UploadPackageToPreReleaseFeed can only be set to True or False. Current value is set to $env:UPLOADPACKAGETOPRERELEASEFEED" |
65 |
| - } |
66 |
| - Write-Host "##vso[task.setvariable variable=UploadPackage]$uploadPackage" |
67 |
| - Write-Host "UploadPackage: $uploadPackage" |
68 |
| - displayName: 'Set UploadPackage variable' |
69 |
| - |
70 | 84 | - task: NuGetCommand@2
|
71 |
| - condition: and(ne(variables['Build.Reason'], 'PullRequest'), in(variables['Build.SourceBranch'], 'refs/heads/v3.x/ps7', 'refs/heads/v3.x/ps6', 'refs/heads/v2.x'), eq(variables.UploadPackage, false)) |
| 85 | + condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['IsReleaseBuild'], 'true'), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], 'false')) |
72 | 86 | inputs:
|
73 | 87 | command: 'push'
|
74 | 88 | packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
|
|
78 | 92 | displayName: 'Push NuGet package'
|
79 | 93 |
|
80 | 94 | - task: NuGetCommand@2
|
81 |
| - condition: eq(variables.UploadPackage, true) |
| 95 | + condition: eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], 'true') |
82 | 96 | inputs:
|
83 | 97 | command: 'push'
|
84 | 98 | packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
|
|
0 commit comments