-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
61 lines (49 loc) · 2.05 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
trigger:
branches:
include:
- main
pool:
vmImage: 'windows-2022'
variables:
buildConfiguration: 'Release'
# Pipeline configuration (Disable shallow fetch).
# See https://dev.to/kkazala/azure-devops-pipelines-shallow-fetch-1-is-now-default-4656 for more details.
# See https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/pipeline-options-for-git?view=azure-devops&tabs=yaml#shallow-fetch for more details.
Agent.Source.Git.ShallowFetchDepth: 0
steps:
- task: gitversion/setup@0
inputs:
versionSpec: '5.12.0'
displayName: 'Install GitVersion'
- task: gitversion/execute@0
inputs:
useConfigFile: true
configFilePath: GitVersion.yml
displayName: 'Calculate Version'
- script: dotnet build --configuration $(buildConfiguration) -p:Version=$(GitVersion.NuGetVersionV2) -p:FileVersion=$(GitVersion.AssemblySemVer) -p:InformationalVersion=$(GitVersion.InformationalVersion)
displayName: Build
- script: dotnet test --no-build --configuration $(buildConfiguration) --logger:trx
displayName: Test
- task: PublishTestResults@2
displayName: Publish Tests Results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*.trx'
mergeTestResults: true
testRunTitle: 'Unit Tests'
- script: dotnet pack --no-build --configuration $(buildConfiguration) -p:Version=$(GitVersion.NuGetVersionV2) --output $(build.artifactStagingDirectory)
displayName: Pack
- task: PublishBuildArtifacts@1
displayName: 'Publish Build Artifacts'
- task: NuGetToolInstaller@1
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq('true', variables['forcePushNuget'])))
inputs:
versionSpec: '>= 4.9'
checkLatest: true
- task: NuGetCommand@2
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq('true', variables['forcePushNuget'])))
inputs:
command: 'push'
packagesToPush: '$(build.artifactStagingDirectory)/**/*.nupkg;!$(build.artifactStagingDirectory)/**/*.snupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet.org - nventive'