@@ -216,34 +216,36 @@ stages:
216
216
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
217
217
$version = $xml.Project.PropertyGroup.Version
218
218
echo $version
219
- echo "##vso[task.setvariable variable=version ]$version"
219
+ echo "##vso[task.setvariable variable=hidiversion ]$version"
220
220
221
221
# publish hidi as an .exe
222
222
- task : DotNetCoreCLI@2
223
+ displayName : publish Hidi as executable
223
224
inputs :
224
225
command : ' publish'
225
- arguments : -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(version ) --no-dependencies
226
+ arguments : -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion ) --no-dependencies
226
227
projects : ' src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
227
228
publishWebProjects : False
228
229
zipAfterPublish : false
229
230
230
- - task : PublishBuildArtifacts@1
231
- displayName : ' Publish Artifact: Hidi'
232
- inputs :
233
- ArtifactName : Microsoft.OpenApi.Hidi-v$(version)
234
- PathtoPublish : ' $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(version)'
235
-
236
231
- task : PublishBuildArtifacts@1
237
232
displayName : ' Publish Artifact: Nugets'
238
233
inputs :
239
234
ArtifactName : Nugets
240
235
PathtoPublish : ' $(Build.ArtifactStagingDirectory)/Nugets'
241
236
237
+ - task : PublishBuildArtifacts@1
238
+ displayName : ' Publish Artifact: Hidi'
239
+ inputs :
240
+ ArtifactName : Microsoft.OpenApi.Hidi-v$(hidiversion)
241
+ PathtoPublish : ' $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)'
242
+
242
243
- stage : deploy
243
244
condition : and(contains(variables['build.sourceBranch'], 'refs/heads/vnext'), succeeded())
244
245
dependsOn : build
245
246
jobs :
246
- - deployment : deploy
247
+ - deployment : deploy_hidi
248
+ dependsOn : []
247
249
environment : nuget-org
248
250
strategy :
249
251
runOnce :
@@ -256,10 +258,88 @@ stages:
256
258
inputs :
257
259
artifact : Nugets
258
260
source : current
261
+ # TODO update that script so it looks at the artifact name (name starts with) rather than a fixed index
262
+ - powershell : |
263
+ $url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build/builds/$env:BUILD_BUILDID/artifacts?api-version=4.1"
264
+ Write-Host "URL: $url"
265
+ $pipeline = Invoke-RestMethod -Uri $url -Headers @{
266
+ Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"
267
+ }
268
+ Write-Host "artifactName:" ($artifactName = $Pipeline.value.name[1])
269
+ #Set Variable $artifactName
270
+ Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true;]$artifactName"
271
+ displayName: 'Fetch Artifact Name'
272
+ - task : DownloadPipelineArtifact@2
273
+ displayName : Download hidi executable from artifacts
274
+ inputs :
275
+ artifact : $(artifactName)
276
+ source : current
277
+ - task : NuGetCommand@2
278
+ displayName : ' NuGet push'
279
+ inputs :
280
+ command : push
281
+ packagesToPush : ' $(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg'
282
+ nuGetFeedType : external
283
+ publishFeedCredentials : ' OpenAPI Nuget Connection'
284
+ - task : GitHubRelease@1
285
+ displayName : ' GitHub release (create)'
286
+ inputs :
287
+ gitHubConnection : ' Github-MaggieKimani1'
288
+ tagSource : userSpecifiedTag
289
+ tag : ' $(artifactName)'
290
+ title : ' $(artifactName)'
291
+ releaseNotesSource : inline
292
+ assets : ' $(System.DefaultWorkingDirectory)\**\*.exe'
293
+ changeLogType : issueBased
294
+
295
+ - deployment : deploy_lib
296
+ dependsOn : []
297
+ environment : nuget-org
298
+ strategy :
299
+ runOnce :
300
+ deploy :
301
+ pool :
302
+ vmImage : ubuntu-latest
303
+ steps :
304
+ - task : DownloadPipelineArtifact@2
305
+ displayName : Download nupkg from artifacts
306
+ inputs :
307
+ artifact : Nugets
308
+ source : current
309
+ - powershell : |
310
+ $fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg"
311
+ foreach($fileName in $fileNames) {
312
+ if(Test-Path $fileName) {
313
+ rm $fileName -Verbose
314
+ }
315
+ }
316
+ displayName: remove other nupkgs to avoid duplication
259
317
- task : NuGetCommand@2
260
318
displayName : ' NuGet push'
261
319
inputs :
262
320
command : push
263
321
packagesToPush : ' $(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.*.nupkg'
264
322
nuGetFeedType : external
265
323
publishFeedCredentials : ' OpenAPI Nuget Connection'
324
+
325
+ - deployment : deploy_readers
326
+ dependsOn : deploy_lib
327
+ environment : nuget-org
328
+ strategy :
329
+ runOnce :
330
+ deploy :
331
+ pool :
332
+ vmImage : ubuntu-latest
333
+ steps :
334
+ - task : DownloadPipelineArtifact@2
335
+ displayName : Download nupkg from artifacts
336
+ inputs :
337
+ artifact : Nugets
338
+ source : current
339
+ - task : NuGetCommand@2
340
+ displayName : ' NuGet push'
341
+ inputs :
342
+ command : push
343
+ packagesToPush : ' $(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg'
344
+ nuGetFeedType : external
345
+ publishFeedCredentials : ' OpenAPI Nuget Connection'
0 commit comments