-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
72 lines (63 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
62
63
64
65
66
67
68
69
70
71
72
trigger:
- master
- develop
stages:
- stage: 'Build'
variables:
buildConfiguration: 'Release'
solutionPath: "Interceptron.sln"
projectsToPackPath: "Interceptron.Core/Interceptron.Core.csproj;Interceptron.DynamicProxy/Interceptron.DynamicProxy.csproj;Interceptron.DispatchProxy/Interceptron.DispatchProxy.csproj"
jobs:
- job:
pool:
vmImage: 'windows-latest'
workspace:
clean: all
steps:
# dotnet build
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: 'build'
projects: '$(solutionPath)'
arguments: '--configuration $(buildConfiguration)'
# dotnet test
- task: DotNetCoreCLI@2
displayName: 'dotnet test $(buildConfiguration)'
inputs:
command: 'test'
projects: '$(solutionPath)'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
# dotnet pack
- task: DotNetCoreCLI@2
displayName: 'Create NuGet Package - Release Version'
inputs:
command: pack
packagesToPack: '$(projectsToPackPath)'
packDirectory: '$(Build.ArtifactStagingDirectory)/packages/releases'
arguments: '--configuration $(buildConfiguration)'
nobuild: true
# publish the package in artifact directory
- publish: '$(Build.ArtifactStagingDirectory)/packages'
artifact: 'packages'
# Publish nuget when the branch is master
- 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-org'
strategy:
runOnce:
deploy:
steps:
- task: NuGetCommand@2
displayName: 'Push NuGet Package'
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/packages/releases/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet'