-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathazure-pipelines.yml
130 lines (116 loc) · 3.48 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
trigger:
branches:
include:
- master
paths:
include:
- src
- test
variables:
majorVersion: 6
minorVersion: 3
patchVersion: 0
project: src/Lifti.Core/Lifti.Core.csproj
testProject: test/Lifti.Tests/Lifti.Tests.csproj
buildConfiguration: 'Release'
stages:
- stage: Build
displayName: Build nuget packages
jobs:
- job: Build
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: "Use .NET 6"
inputs:
packageType: 'sdk'
version: '6.0.x'
- task: UseDotNet@2
displayName: "Use .NET 7"
inputs:
packageType: 'sdk'
version: '7.0.x'
- task: UseDotNet@2
displayName: "Use .NET 8"
inputs:
packageType: 'sdk'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: "NuGet Restore"
inputs:
command: restore
projects: '**/*.csproj'
verbosityRestore: 'Normal'
- task: DotNetCoreCLI@2
displayName: Run unit tests
inputs:
command: 'test'
projects: $(testProject)
- task: DotNetCoreCLI@2
displayName: Pack CI nuget version
inputs:
command: 'pack'
packagesToPack: $(project)
packDirectory: '$(Build.ArtifactStagingDirectory)/packages/ci'
versioningScheme: 'byPrereleaseNumber'
majorVersion: '$(majorVersion)'
minorVersion: '$(minorVersion)'
patchVersion: '$(patchVersion)'
verbosityPack: 'Normal'
arguments: '--configuration $(buildConfiguration)'
- task: PublishSymbols@2
inputs:
SearchPattern: '**/bin/**/*.pdb'
SymbolServerType: 'TeamServices'
- task: DotNetCoreCLI@2
displayName: Pack release nuget version
inputs:
command: 'pack'
packagesToPack: $(project)
packDirectory: '$(Build.ArtifactStagingDirectory)/packages/release'
versioningScheme: 'off'
buildProperties: 'PackageVersion=$(majorVersion).$(minorVersion).$(patchVersion)'
verbosityPack: 'Normal'
arguments: '--configuration $(buildConfiguration)'
- publish: '$(Build.ArtifactStagingDirectory)/packages'
artifact: 'packages'
- stage: PublishCINugetPackage
displayName: Publish to CI feed
dependsOn: Build
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: PublishCI
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: none
- download: current
artifact: 'packages'
- task: NuGetCommand@2
displayName: 'Push NuGet Package'
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/packages/ci/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet'
- stage: 'PublishReleaseNuGetPackage'
displayName: 'Publish Release NuGet Package'
dependsOn: 'Build'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment:
pool:
vmImage: 'ubuntu-latest'
environment: 'Nuget'
strategy:
runOnce:
deploy:
steps:
- task: NuGetCommand@2
displayName: 'Push NuGet Package'
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/packages/release/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet'