-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
install-nbgv-tool.yml
49 lines (40 loc) · 1.69 KB
/
install-nbgv-tool.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
steps:
#######################################
# # need to have this here when there is a new release that hasn't made it to the CI VMs
# - task: DotNetCoreCLI@2
# displayName: Update NBGV tool
# condition: succeeded()
# inputs:
# command: custom
# custom: tool
# arguments: update -g nbgv
- script: nbgv --version
condition: succeeded()
displayName: Show nbgv version
- script: nbgv cloud -a -c
condition: succeeded()
displayName: Set build number
- task: PowerShell@2
condition: and(succeeded(), eq(variables['StartReleaseCandidate'], false))
displayName: Get NuGet build number
inputs:
targetType: 'inline'
script: |
$MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace ".g$env:NBGV_GitCommitIdShort", ""
# replace preview with alpha if this is a PR build
if($env:System_PullRequest_PullRequestId -ne $null)
{
# mix PR and VersionHeight
$alphaNumber = [int]$env:System_PullRequest_PullRequestNumber + $env:NBGV_VersionHeight;
$alphaPrString = "alpha." + $alphaNumber.ToString()
$MyNuGetVersion = $MyNuGetVersion -replace "preview", $alphaPrString
}
if ($env:System_PullRequest_SourceBranch -like 'release*')
{
$MyNuGetVersion = $MyNuGetVersion + "-rc." + $env:NBGV_VersionHeight
}
Write-Host "NuGet build is: $MyNuGetVersion"
Write-Host "Assembly version is: $env:NBGV_AssemblyVersion"
Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"