@@ -5,13 +5,15 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
55trigger :
66 branches :
77 include :
8- - master
9- - vnext
8+ - main
9+ - dev
10+ - support/v1
1011pr :
1112 branches :
1213 include :
13- - master
14- - vnext
14+ - main
15+ - dev
16+ - support/v1
1517variables :
1618 buildPlatform : ' Any CPU'
1719 buildConfiguration : ' Release'
@@ -41,10 +43,6 @@ extends:
4143 displayName : ' Publish Artifact: Nugets'
4244 artifactName : Nugets
4345 targetPath : ' $(Build.ArtifactStagingDirectory)/Nugets'
44- - output : pipelineArtifact
45- displayName : ' Publish Artifact: Hidi'
46- artifactName : Microsoft.OpenApi.Hidi-v$(hidiversion)
47- targetPath : ' $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)'
4846 steps :
4947 - task : UseDotNet@2
5048 displayName : ' Use .NET 6'
@@ -177,23 +175,13 @@ extends:
177175 MaxConcurrency : ' 50'
178176 MaxRetryAttempts : ' 5'
179177 PendingAnalysisWaitTimeoutMinutes : ' 5'
180-
181- - task : PowerShell@2
182- displayName : " Get Hidi's version-number from .csproj"
183- inputs :
184- targetType : ' inline'
185- script : |
186- $xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
187- $version = $xml.Project.PropertyGroup.Version
188- echo $version
189- echo "##vso[task.setvariable variable=hidiversion]$version"
190-
178+
191179 # publish hidi as an .exe
192180 - task : DotNetCoreCLI@2
193181 displayName : publish Hidi as executable
194182 inputs :
195183 command : ' publish'
196- arguments : -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)
184+ arguments : -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi
197185 projects : ' src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
198186 publishWebProjects : False
199187 zipAfterPublish : false
@@ -206,10 +194,17 @@ extends:
206194 content : ' *.nupkg'
207195
208196 - stage : deploy
209- condition : and(contains(variables['build.sourceBranch'], 'refs/heads/master' ), succeeded())
197+ condition : and(or( contains(variables['build.sourceBranch'], 'refs/heads/main'),contains(variables['build.sourceBranch'], 'refs/heads/support/v1') ), succeeded())
210198 dependsOn : build
211199 jobs :
212200 - deployment : deploy_hidi
201+ templateContext :
202+ type : releaseJob
203+ isProduction : true
204+ inputs :
205+ - input : pipelineArtifact
206+ artifactName : Nugets
207+ targetPath : ' $(Pipeline.Workspace)'
213208 dependsOn : []
214209 environment : nuget-org
215210 strategy :
@@ -218,15 +213,6 @@ extends:
218213 pool :
219214 vmImage : ubuntu-latest
220215 steps :
221- - task : DownloadPipelineArtifact@2
222- displayName : Download nupkg from artifacts
223- inputs :
224- artifact : Nugets
225- source : current
226- - task : DownloadPipelineArtifact@2
227- displayName : Download hidi executable from artifacts
228- inputs :
229- source : current
230216 - pwsh : |
231217 $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
232218 $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", ""
@@ -264,6 +250,13 @@ extends:
264250 ]'
265251
266252 - deployment : deploy_lib
253+ templateContext :
254+ type : releaseJob
255+ isProduction : true
256+ inputs :
257+ - input : pipelineArtifact
258+ artifactName : Nugets
259+ targetPath : ' $(Pipeline.Workspace)'
267260 dependsOn : []
268261 environment : nuget-org
269262 strategy :
@@ -272,11 +265,6 @@ extends:
272265 pool :
273266 vmImage : ubuntu-latest
274267 steps :
275- - task : DownloadPipelineArtifact@2
276- displayName : Download nupkg from artifacts
277- inputs :
278- artifact : Nugets
279- source : current
280268 - powershell : |
281269 $fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg"
282270 foreach($fileName in $fileNames) {
@@ -294,6 +282,13 @@ extends:
294282 publishFeedCredentials : ' OpenAPI Nuget Connection'
295283
296284 - deployment : deploy_readers
285+ templateContext :
286+ type : releaseJob
287+ isProduction : true
288+ inputs :
289+ - input : pipelineArtifact
290+ artifactName : Nugets
291+ targetPath : ' $(Pipeline.Workspace)'
297292 dependsOn : deploy_lib
298293 environment : nuget-org
299294 strategy :
@@ -302,11 +297,6 @@ extends:
302297 pool :
303298 vmImage : ubuntu-latest
304299 steps :
305- - task : DownloadPipelineArtifact@2
306- displayName : Download nupkg from artifacts
307- inputs :
308- artifact : Nugets
309- source : current
310300 - task : 1ES.PublishNuget@1
311301 displayName : ' NuGet push'
312302 inputs :
0 commit comments