-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
86 lines (73 loc) · 2.35 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
# https://docs.microsoft.com/azure/devops/pipelines/yaml-schema
variables:
- group: 'Secrets'
stages:
- stage: BuildStage
displayName: 'Build'
jobs:
- job: BuildJob
displayName: 'Build'
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 0
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
useGlobalJson: true
# https://github.com/dotnet/sdk/issues/44951
# - task: DotNetCoreCLI@2
# displayName: 'dotnet format'
# inputs:
# command: 'custom'
# custom: 'format'
# arguments: '--verify-no-changes'
- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: |
SwaggerUI.OpenApi.sln
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: test
projects: 'test/*.Tests/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: pack
packDirectory: 'artifacts'
- publish: '$(Build.Repository.LocalPath)/artifacts'
displayName: 'Publish artifacts'
artifact: 'packages'
- task: DotNetCoreCLI@2
displayName: 'Push to GitHub'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
inputs:
command: 'custom'
custom: 'nuget'
arguments: 'push artifacts/*.nupkg --skip-duplicate --api-key $(GitHubPackageRepositoryKey) --source https://nuget.pkg.github.com/ctyar/index.json'
- stage: DeployStage
displayName: 'Deploy'
jobs:
- deployment: NugetDeployJob
displayName: 'Deploy to Nuget.org'
pool:
vmImage: 'ubuntu-latest'
environment: 'NugetEnvironment'
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: 'Download artifacts'
artifact: 'packages'
- task: DotNetCoreCLI@2
displayName: 'Push to Nuget.org'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
inputs:
command: 'custom'
custom: 'nuget'
arguments: 'push $(Pipeline.Workspace)/packages/*.nupkg --api-key $(NugetKey) --source https://api.nuget.org/v3/index.json'