-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
79 lines (67 loc) · 2.15 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
# 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
- 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: |
Swashbuckle.Auth.sln
- 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'