Skip to content

Commit 1eeb31a

Browse files
committed
Update ci-build.yml for Azure Pipelines
- Adds powershell script to fetch the version number from .csproj - Adds a publish task for publishing hidi as a self-contained .exe application to the artifact staging directory - Publish the generated artifact to the specified location
1 parent 9551e33 commit 1eeb31a

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ pool:
1919
steps:
2020
- task: NuGetCommand@2
2121
displayName: 'NuGet restore'
22+
23+
- task: UseDotNet@2
24+
displayName: 'Use .NET Core sdk'
25+
inputs:
26+
packageType: 'sdk'
27+
version: '6.0.x'
28+
includePreviewVersions: true
2229

2330
- task: MSBuild@1
2431
displayName: 'Build solution **/*.sln'
@@ -127,7 +134,31 @@ steps:
127134
]
128135
SessionTimeout: 20
129136

137+
- task: PowerShell@2
138+
displayName: "Get Hidi's version-number from .csproj"
139+
inputs:
140+
targetType: 'inline'
141+
script: |
142+
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
143+
$version = $xml.Project.PropertyGroup.Version
144+
echo $version
145+
echo "##vso[task.setvariable variable=version]$version"
146+
147+
# publish hidi as an .exe
148+
- task: DotNetCoreCLI@2
149+
inputs:
150+
command: 'publish'
151+
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory) --no-dependencies
152+
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
153+
publishWebProjects: False
154+
zipAfterPublish: false
155+
130156
- task: PublishBuildArtifacts@1
131157
displayName: 'Publish Artifact: Nugets'
132158
inputs:
133-
ArtifactName: Nugets
159+
ArtifactName: Nugets
160+
161+
- task: PublishBuildArtifacts@1
162+
displayName: 'Publish Artifact: Hidi'
163+
inputs:
164+
ArtifactName: Microsoft.OpenApi.Hidi-v$(version)

0 commit comments

Comments
 (0)