-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
110 lines (107 loc) · 3.22 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
variables:
BuildConfiguration: Release
trigger:
branches:
include:
- "*"
- "refs/tags/*"
exclude:
- "master"
paths:
include:
- src/*
stages:
- stage: Build
variables:
- group: ReleaseNugetFeed
- group: BetaNugetFeed
jobs:
- job:
displayName: Build
steps:
- task: GitVersion@5
displayName: "Git Version"
inputs:
runtime: 'core'
configFilePath: 'tools/config/GitVersion.yml'
updateAssemblyInfo: true
- task: DotNetCoreCLI@2
displayName: "Build"
inputs:
command: 'build'
projects: 'src/**/*.csproj'
arguments: '-o $(build.artifactStagingDirectory)/out -c $(BuildConfiguration) /p:PackageVersion=$(GitVersion.NuGetVersionV2)'
- task: DotNetCoreCLI@2
displayName: 'Run unit tests'
inputs:
command: 'test'
projects: '**/*/*.Tests.Unit.csproj'
- task: CopyFiles@2
displayName: 'Copy nuget.config'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/tools/config'
Contents: 'NuGet.config'
TargetFolder: '$(build.artifactStagingDirectory)/final'
- task: CopyFiles@2
displayName: 'Copy nuget packages'
inputs:
SourceFolder: '$(build.artifactStagingDirectory)/out'
Contents: '*.nupkg'
TargetFolder: '$(build.artifactStagingDirectory)/final'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(build.artifactStagingDirectory)/final'
artifact: 'nuget'
publishLocation: 'pipeline'
- stage: PublishBetaFeed
displayName: 'Publish to beta feed'
variables:
- group: BetaNugetFeed
jobs:
- deployment: DeployToBetaNugetFeed
displayName: Publish to beta nuget feed
pool:
vmImage: 'ubuntu-latest'
environment: 'Beta Nuget Feed'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: nuget
- task: DotNetCoreCLI@2
displayName: "Push"
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/nuget/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '$(TargetFeedId)'
- stage: PublishReleaseFeed
displayName: 'Publish to release feed'
variables:
- group: ReleaseNugetFeed
jobs:
- deployment: DeployToReleaseNugetFeed
displayName: Publish to release nuget feed
pool:
vmImage: 'ubuntu-latest'
environment: 'Release Nuget Feed'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: nuget
- task: replacetokens@3
inputs:
rootDirectory: '$(Pipeline.Workspace)'
targetFiles: '**/*.config'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '%'
tokenSuffix: '%'
- script: |
dotnet nuget push "*.nupkg" --source "github"
workingDirectory: '$(Pipeline.Workspace)/nuget'