|
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 | + $isReleaseBuild = ($releaseBranches -contains $env:BuildSourceBranchName) |
| 29 | + Write-Host "##vso[task.setvariable variable=IsReleaseBuild]$isReleaseBuild" |
| 30 | + Write-Host "IsReleaseBuild: $isReleaseBuild" |
| 31 | + displayName: 'Set IsReleaseBuild variable' |
| 32 | + env: |
| 33 | + BuildSourceBranchName: $(Build.SourceBranchName) |
| 34 | + |
25 | 35 | - pwsh: ./build.ps1 -NoBuild -Bootstrap |
26 | 36 | displayName: 'Running ./build.ps1 -NoBuild -Bootstrap' |
27 | 37 |
|
28 | 38 | - pwsh: | |
29 | 39 | $ErrorActionPreference = "Stop" |
30 | | - ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" |
| 40 | + if ($isReleaseBuild) |
| 41 | + { |
| 42 | + ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" -AddSBOM -SBOMUtilSASUrl $env:SBOMUtilSASUrl |
| 43 | + } |
| 44 | + else |
| 45 | + { |
| 46 | + ./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)" |
| 47 | + } |
31 | 48 | displayName: 'Build worker code' |
| 49 | + env: |
| 50 | + SBOMUtilSASUrl: $(SBOMUtilSASUrl) |
32 | 51 |
|
33 | 52 | - pwsh: ./build.ps1 -NoBuild -Test |
34 | 53 | displayName: 'Running UnitTest' |
@@ -57,18 +76,8 @@ steps: |
57 | 76 | TargetFolder: '$(Build.ArtifactStagingDirectory)' |
58 | 77 | displayName: 'Copy package to artifacts directory' |
59 | 78 |
|
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 | 79 | - task: NuGetCommand@2 |
71 | | - condition: and(ne(variables['Build.Reason'], 'PullRequest'), in(variables['Build.SourceBranch'], 'refs/heads/v4.x/ps7.2', 'refs/heads/v4.x/ps7.0' , 'refs/heads/v3.x/ps7', 'refs/heads/v3.x/ps6', 'refs/heads/v2.x'), eq(variables.UploadPackage, false)) |
| 80 | + condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['IsReleaseBuild'], true), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], false)) |
72 | 81 | inputs: |
73 | 82 | command: 'push' |
74 | 83 | packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' |
|
78 | 87 | displayName: 'Push NuGet package' |
79 | 88 |
|
80 | 89 | - task: NuGetCommand@2 |
81 | | - condition: eq(variables.UploadPackage, true) |
| 90 | + condition: eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true) |
82 | 91 | inputs: |
83 | 92 | command: 'push' |
84 | 93 | packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' |
|
0 commit comments