-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
88 lines (77 loc) · 2.28 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
# 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'
workspace:
clean: all
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: pack
packDirectory: 'artifacts'
- publish: '$(Build.Repository.LocalPath)/artifacts'
displayName: 'Publish artifacts'
artifact: 'packages'
- stage: PublishAlphaPackageStage
displayName: 'Publish alpha package'
dependsOn: BuildStage
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment:
pool:
vmImage: 'ubuntu-latest'
environment: 'Github package repository'
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: 'Download artifacts'
artifact: 'packages'
- task: PowerShell@2
displayName: 'Push the packages to GitHub Packages'
env:
GITHUB_API_KEY: $(GITHUB_API_KEY)
inputs:
targetType: 'inline'
script: |
dotnet tool install -g gpr
gpr push --api-key $env:GITHUB_API_KEY $(Pipeline.Workspace)/packages/*.nupkg
failOnStderr: true
ignoreLASTEXITCODE: true
# https://github.com/microsoft/azure-pipelines-yaml/issues/344
- stage: PublishFinalPackageStage
displayName: 'Publish final package'
dependsOn: PublishAlphaPackageStage
condition: succeeded()
jobs:
- deployment:
pool:
vmImage: 'ubuntu-latest'
environment: 'Nuget org'
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: 'Download artifacts'
artifact: 'packages'
- task: NuGetCommand@2
displayName: 'Push the packages to Nuget.org'
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/packages/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'PingctNugetConnection'