This repository has been archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines.yml
131 lines (129 loc) · 3.81 KB
/
azure-pipelines.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
trigger:
- main
- refs/tags/*
- dev
variables:
- name: Solution
value: 'Tooling'
- name: ProductVersion
value: '0.7.1'
- name: PackageVersion
value: $[format('0.7.1-{0}', variables['Build.BuildId'])]
- name: DotNet2Version
value: 2.1.x
- name: DotNet3Version
value: 3.1.x
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- group: 'PackageSigningSecrets'
jobs:
- job: 'Linux'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'OSX'
pool:
vmImage: 'macOS-10.14'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'Windows'
pool:
vmImage: 'Windows-2019'
steps:
- pwsh: |
if ($env:BUILD_SOURCEBRANCH -match "^refs\/tags\/(.+)")
{
$env:PackageVersion = $Matches.1
}
Write-Host "build version set to $env:PackageVersion"
$prefix = $env:PackageVersion.Split('-')[0]
$suffix = $env:PackageVersion.Split('-')[1]
Write-Host "##vso[build.updatebuildnumber]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=VersionPrefix;]$prefix"
Write-Host "##vso[task.setvariable variable=VersionSuffix;]$suffix"
env:
PackageVersion: $(PackageVersion)
displayName: 'Version'
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'pack'
packagesToPack: '$(Solution).sln'
arguments: '--configuration $(buildConfiguration) /p:TreatWarningsAsErrors=True /p:VersionPrefix=$(VersionPrefix) /p:VersionSuffix=$(VersionSuffix)'
versioningScheme: 'byEnvVar'
versionEnvVar: 'PackageVersion'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- task: PowerShell@2
displayName: 'Sign'
inputs:
filePath: build/sign-packages.ps1
env:
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
ArtifactDirectory: $(Build.ArtifactStagingDirectory)
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
- task: 'PublishBuildArtifacts@1'
displayName: 'Publish'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Packages'
publishLocation: 'Container'
condition: 'always()'