1
+ name : $(Date:yyyyMMdd).$(Rev:r)
1
2
trigger : none
2
3
pr : none
3
4
4
5
parameters :
5
- - name : IsTestRun
6
- type : boolean
7
- default : true
8
- - name : IsDryRun
6
+ - name : DraftRelease
9
7
type : boolean
10
8
default : true
11
9
12
10
variables :
13
11
- template : /eng/common/templates-official/variables/pool-providers.yml@self
14
12
- name : _TeamName
15
13
value : DotNetCore
16
- readonly : true
17
- - group : Release-Pipeline
18
- - name : IsDryRun
19
- value : ${{ parameters.IsDryRun }}
20
- readonly : true
21
- - name : IsTestRun
22
- value : ${{ parameters.IsTestRun }}
23
- readonly : true
14
+ - name : BAR_ID
15
+ value : ' '
16
+ - name : DRP_DownloadPath
17
+ value : $(System.ArtifactsDirectory)\DarcDrop\$(DRP_ReleaseId)
18
+ - name : DRP_DraftRelease
19
+ value : ${{ parameters.DraftRelease }}
20
+ - name : DRP_GithubOrg
21
+ value : dotnet
22
+ - name : DRP_GithubRepo
23
+ value : dotnet-monitor
24
+ - name : DRP_MonitorRelease
25
+ value : $(Pipeline.Workspace)\dotnet-monitor_build\StagingToolAssetsLayout
26
+ - name : DRP_NugetFeed
27
+ value : https://api.nuget.org/v3/index.json
28
+ - name : DRP_OutputManifestPath
29
+ value : $(DRP_MonitorRelease)\publishManifest.json
30
+ - name : DRP_PublishSharePath
31
+ value : $(DRP_BaseShare)\dotnet-monitor-$(DRP_ReleaseId)
32
+ - name : DRP_ReleaseId
33
+ value : $(Build.BuildNumber)
34
+ - name : DRP_ReleaseNotes
35
+ value : $(DRP_RepoRoot)\documentation\releaseNotes\releaseNotes.$(ShortReleaseVersion).md
36
+ - name : DRP_RepoRoot
37
+ value : $(Build.SourcesDirectory)
38
+ - name : DRP_Verbose
39
+ value : false
40
+ - name : Monitor_PublishedPackageCount
41
+ value : 1
24
42
25
43
resources :
26
44
pipelines :
@@ -35,20 +53,191 @@ extends:
35
53
enabled : false
36
54
stages :
37
55
- stage : Validation
38
-
56
+ displayName : Pre-Release Verification
57
+ variables :
58
+ - group : Release-Pipeline
39
59
jobs :
40
- - job : Validate
41
-
42
- variables :
43
- # Allow for differentiation of runs of this pipeline
44
- # when running it with the same build repeatedly.
45
- - name : RunRevision
46
- value : $[counter(format('{0}|{1}|{2}', variables['resources.pipeline.Build.runID'], variables['IsDryRun'], variables['IsTestRun']), 1)]
47
- readonly : true
48
-
49
- workspace :
50
- clean : all
51
-
60
+ - job : Job_1
61
+ displayName : Release Verification
62
+ condition : succeeded()
63
+ timeoutInMinutes : 0
52
64
steps :
53
- - download : none
65
+ - checkout : self
66
+ - download : dotnet-monitor_build
67
+ artifact : StagingToolAssetsLayout
68
+ - task : PowerShell@2
69
+ displayName : Get BAR ID
70
+ inputs :
71
+ filePath : $(DRP_RepoRoot)\eng\release\Scripts\GetBarId.ps1
72
+ arguments : -BuildId "$(resources.pipeline.dotnet-monitor_build.runID)" -TaskVariableName 'BarId'
73
+ env :
74
+ SYSTEM_ACCESSTOKEN : $(System.AccessToken)
75
+ - task : AzureCLI@2
76
+ displayName : Get Release Version
77
+ inputs :
78
+ connectedServiceNameARM : ' Darc: Maestro Production'
79
+ scriptType : ps
80
+ scriptPath : $(DRP_RepoRoot)\eng\release\Scripts\GetReleaseVersion.ps1
81
+ scriptArguments : -BarId "$(BarId)" -TaskVariableName 'ReleaseVersion' -IncludeV
82
+ - task : PowerShell@2
83
+ displayName : Get Short Release Version
84
+ inputs :
85
+ targetType : inline
86
+ script : |
87
+ if (-Not ('$(ReleaseVersion)' -match '^v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<versionLabel>[a-zA-Z]+)\.(?<iteration>\d+))?'))
88
+ {
89
+ Write-Error "Unable to parse release version"
90
+ exit 1
91
+ }
92
+ if ($Matches.versionLabel)
93
+ {
94
+ $shortVersion="$($Matches.major).$($Matches.minor).$($Matches.patch)-$($Matches.versionLabel).$($Matches.iteration)"
95
+ }
96
+ else
97
+ {
98
+ $shortVersion="$($Matches.major).$($Matches.minor).$($Matches.patch)"
99
+ }
100
+ Write-Host "##vso[task.setvariable variable=ShortReleaseVersion]v$shortVersion"
101
+ - task : PowerShell@2
102
+ displayName : Set Release Name
103
+ inputs :
104
+ targetType : inline
105
+ script : |
106
+ # Write your PowerShell commands here.
107
+ $newReleaseName = "${env:ReleaseVersion}-${env:BUILD_BUILDNUMBER}";
108
+ if ($(DRP_DraftRelease) -eq "true") {
109
+ $newReleaseName += "[Draft]";
110
+ }
111
+ Write-Host "Setting release name to: $newReleaseName";
112
+ Write-Host "##vso[build.updatebuildnumber]$newReleaseName";
113
+ - task : PowerShell@2
114
+ displayName : Check for Nuget Assets
115
+ inputs :
116
+ targetType : inline
117
+ script : |-
118
+ $nugetPath = "${env:DRP_MONITORRELEASE}\NugetAssets";
119
+ Write-Host "Looking for nuget packages under $nugetPath";
120
+ if (-not (Test-Path -path $nugetPath)) {
121
+ Write-Host "##vso[task.logissue type=error]Can't find file at $nugetPath";
122
+ exit 1;
123
+ }
124
+ else {
125
+ $pkgs = Get-ChildItem -Path "$nugetPath" -Filter "*.nupkg" -Recurse;
126
+ $measurePkgs = $pkgs | Measure-Object;
127
+ if (${env:Monitor_PublishedPackageCount} -ne $measurePkgs.Count) {
128
+ Write-Host "##vso[task.logissue type=error]Expected ${env:Monitor_PublishedPackageCount} .nupkg files, found $($measurePkgs.Count) packages.";
129
+ }
130
+ else {
131
+ Write-Host "Found $($measurePkgs.Count) packages, as expected.";
132
+ }
133
+ }
134
+ - task : PowerShell@2
135
+ displayName : Check for Release Notes
136
+ inputs :
137
+ targetType : inline
138
+ script : |-
139
+ $notesPath = $env:DRP_ReleaseNotes;
140
+ Write-Host "Looking for release notes at $notesPath";
141
+ if (-not (Test-Path -path $notesPath)) {
142
+ Write-Host "##vso[task.logissue type=error]Can't find file at $notesPath";
143
+ exit 1;
144
+ }
145
+ else {
146
+ $notesContent = Get-Content -Path $notesPath;
147
+ Write-Host "Contents of $notesPath :";
148
+ Write-Host "$notesContent";
149
+ }
150
+ - job : PostDeploymentApprovalJob
151
+ displayName : Post-Deployment Approval
152
+ condition : succeeded()
153
+ timeoutInMinutes : 0
154
+ pool : server
155
+ steps :
156
+ - task : ManualValidation@1
157
+ inputs :
158
+ notifyUsers : |-
159
+ [TEAM FOUNDATION]\.NET Monitor Working Group
160
+ approvers : |-
161
+ [TEAM FOUNDATION]\.NET Monitor Working Group
162
+ - stage : Nuget
163
+ displayName : Push To NuGet Feed
164
+ dependsOn : Validation
165
+ variables :
166
+ - group : .NET Core Nuget API Keys
167
+ jobs :
168
+ - job : Job_1
169
+ displayName : Push To NuGet
170
+ condition : succeeded()
171
+ timeoutInMinutes : 0
172
+ steps :
173
+ - checkout : self
174
+ - download : dotnet-monitor_build
175
+ artifact : StagingToolAssetsLayout
176
+ - task : NuGetAuthenticate@0
177
+ enabled : eq(parameters.DraftRelease, false)
178
+ displayName : Authenticate to AzDO Feeds
179
+ - task : PowerShell@2
180
+ displayName : Push To NuGet
181
+ enabled : eq(parameters.DraftRelease, false)
182
+ inputs :
183
+ filePath : $(DRP_RepoRoot)\eng\release\Scripts\PublishToNuget.ps1
184
+ arguments : -ManifestPath $(DRP_OutputManifestPath) -StagingPath $(DRP_MonitorRelease) -FeedEndpoint $(DRP_NugetFeed) -FeedPat $(DotNetNugetApiKey-A4)
185
+ failOnStderr : true
186
+ - stage : Release
187
+ displayName : Create GitHub Release
188
+ dependsOn : Nuget
189
+ condition : succeeded()
190
+ variables :
191
+ - group : Release-Pipeline
192
+ jobs :
193
+ - job : Job_1
194
+ displayName : Create GitHub Release
195
+ condition : succeeded()
196
+ timeoutInMinutes : 0
197
+ steps :
198
+ - checkout : self
199
+ - download : dotnet-monitor_build
200
+ artifact : StagingToolAssetsLayout
201
+ - task : PowerShell@2
202
+ displayName : Get BAR ID
203
+ inputs :
204
+ filePath : $(DRP_RepoRoot)\eng\release\Scripts\GetBarId.ps1
205
+ arguments : -BuildId "$(resources.pipeline.dotnet-monitor_build.runID)" -TaskVariableName 'BarId'
206
+ env :
207
+ SYSTEM_ACCESSTOKEN : $(System.AccessToken)
208
+ - task : AzureCLI@2
209
+ displayName : Get Release Version
210
+ inputs :
211
+ connectedServiceNameARM : ' Darc: Maestro Production'
212
+ scriptType : ps
213
+ scriptPath : $(DRP_RepoRoot)\eng\release\Scripts\GetReleaseVersion.ps1
214
+ scriptArguments : -BarId "$(BarId)" -TaskVariableName 'ReleaseVersion' -IncludeV
215
+ - task : PowerShell@2
216
+ displayName : Get Short Release Version
217
+ inputs :
218
+ targetType : inline
219
+ script : |-
220
+ if (-Not ('$(ReleaseVersion)' -match '^v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<versionLabel>[a-zA-Z]+)\.(?<iteration>\d+))?'))
221
+ {
222
+ Write-Error "Unable to parse release version"
223
+ exit 1
224
+ }
225
+ if ($Matches.versionLabel)
226
+ {
227
+ $shortVersion="$($Matches.major).$($Matches.minor).$($Matches.patch)-$($Matches.versionLabel).$($Matches.iteration)"
228
+ }
229
+ else
230
+ {
231
+ $shortVersion="$($Matches.major).$($Matches.minor).$($Matches.patch)"
232
+ }
233
+ Write-Host "##vso[task.setvariable variable=ShortReleaseVersion]v$shortVersion"
234
+ - task : PowerShell@2
235
+ displayName : Generate Release
236
+ inputs :
237
+ filePath : $(DRP_RepoRoot)\eng\release\Scripts\GenerateGithubRelease.ps1
238
+ arguments : -ManifestPath $(DRP_OutputManifestPath) -ReleaseNotes $(DRP_ReleaseNotes) -GhRepository $(DRP_GithubRepo) -GhOrganization $(DRP_GithubOrg) -TagName $(ReleaseVersion) -DraftRelease $$(DRP_DraftRelease)
239
+ workingDirectory : $(DRP_RepoRoot)
240
+ env :
241
+ GITHUB_TOKEN : $(BotAccount-dotnet-bot-repo-PAT)
242
+
54
243
0 commit comments