-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
148 lines (129 loc) · 3.87 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: 1.0.$(rev:.r)
trigger:
batch: true
branches:
include:
- refs/heads/master
- refs/heads/develop
paths:
include:
- src
- azure-pipelines.yml
exclude:
- README.md
pool:
vmImage: 'windows-latest'
variables:
nuGetVersion: 6.8.0
nugetPackageVersion: '1.11.0'
buildConfiguration: 'Release'
publishFeedCredentials: 'nuget-devops'
publishVstsFeed: '9e255e84-89be-45b6-8204-7e067e291e8c/0a8f441d-a616-4424-b6a8-1aac73cf855b'
stages:
- stage: build
jobs:
- job: code
steps:
- task: NuGetToolInstaller@0
displayName: 'use NuGet $(nuGetVersion)'
inputs:
versionSpec: '$(nuGetVersion)'
- task: UseDotNet@2
displayName: 'use dotnet SDK 8.x'
inputs:
packageType: sdk
version: '8.x'
- task: UseDotNet@2
displayName: 'use dotnet SDK 7.x'
inputs:
packageType: sdk
version: '7.x'
- task: UseDotNet@2
displayName: 'use dotnet SDK 6.x'
inputs:
packageType: sdk
version: '6.x'
- task: UseDotNet@2
displayName: 'use dotnet SDK 3.1.x'
inputs:
packageType: sdk
version: '3.1.x'
- task: UseDotNet@2
displayName: 'use dotnet SDK 2.1.x'
inputs:
packageType: sdk
version: '2.1.x'
- task: NuGetCommand@2
displayName: 'nuget restore'
inputs:
restoreSolution: 'src/*.sln'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration)'
projects: 'src/*.sln'
- task: DotNetCoreCLI@2
displayName: 'dotnet tests'
inputs:
command: 'test'
projects: 'src/*.Unit.Tests/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: 'pack'
packagesToPack: 'src/josearias210.DDD/josearias210.DDD.csproj'
nobuild: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'nugetPackageVersion'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact to Pipeline'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
- stage: release_azure_devops
displayName: 'release azure devops'
dependsOn: build
jobs:
- job: deploy_azure_devops_artifacts
displayName: 'deploy artifacts'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'download artifacts'
inputs:
path: '$(Build.ArtifactStagingDirectory)'
patterns: '**/*.nupkg'
- task: NuGetCommand@2
displayName: 'nuget push'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '$(publishVstsFeed)'
allowPackageConflicts: true
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
- stage: release_nuget_org
displayName: 'release nuget.org'
dependsOn: release_azure_devops
jobs:
- deployment: 'deploy_nuget_org_artifacts'
displayName: 'deploy artifacts'
environment: 'nuget'
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'download artifacts'
inputs:
path: '$(Build.ArtifactStagingDirectory)'
patterns: '**/*.nupkg'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/drop/josearias210.DDD.*.nupkg'
nuGetFeedType: external
publishFeedCredentials: '$(publishFeedCredentials)'