-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
143 lines (126 loc) · 3.56 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
trigger:
branches:
include:
- v11/main
- v11/develop
- v11/release/*
- v11/hotfix
tags:
include:
- 11.*
pool:
name: Default
variables:
BuildConfiguration: 'release'
BuildPlatform: 'any cpu'
Solution: '**\*.sln'
PackageDownloadPatterns: |
**/*.nupkg
**/*.snupkg
stages:
- stage: build
displayName: Build
jobs:
- job: build
displayName: Build
steps:
- checkout: self
displayName: Clone repository
fetchDepth: 0
clean: true
- task: GitVersion@5
displayName: GitVersion
inputs:
configFilePath: GitVersion.yml
updateAssemblyInfo: true
- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
packageType: 'sdk'
version: '7.x'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
feedsToUse: config
nugetConfigPath: nuget.config
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: ETag.sln
arguments: '--configuration $(BuildConfiguration) -p:Version=$(GitVersion.NuGetVersion)'
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
arguments: '--configuration $(BuildConfiguration) -p:Version=$(GitVersion.NuGetVersion)'
packagesToPack: src/**/*.csproj
versioningScheme: byEnvVar
versionEnvVar: GitVersion.NuGetVersion
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: dryrun
displayName: Dry run
dependsOn: build
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
jobs:
- job: download
displayName: Test download
workspace:
clean: all
steps:
- checkout: none
- download: current
patterns: $(PackageDownloadPatterns)
displayName: Download packages and symbols
- stage: release
displayName: Release
dependsOn: build
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
variables:
packageGlob: '$(Pipeline.Workspace)/**/Infocaster.Umbraco.ETag*.nupkg'
symbolsGlob: '$(Pipeline.Workspace)/**/Infocaster.Umbraco.ETag*.snupkg'
jobs:
- job: releaseArtifact
displayName: Push to artifacts
workspace:
clean: all
steps:
- checkout: none
- download: current
patterns: $(PackageDownloadPatterns)
displayName: Download build artifact
- task: DotNetCoreCLI@2
displayName: 'Push package to artifacts'
inputs:
command: push
publishVstsFeed: '3356baca-d7d8-497c-a5fa-ebd93f79f7c7'
versioningScheme: byBuildNumber
packagesToPush: $(packageGlob)
- task: DotNetCoreCLI@2
displayName: 'Push symbols to artifacts'
inputs:
command: push
publishVstsFeed: '3356baca-d7d8-497c-a5fa-ebd93f79f7c7'
versioningScheme: byBuildNumber
packagesToPush: $(symbolsGlob)
- job: releaseNuget
displayName: Push to nuget
workspace:
clean: all
steps:
- checkout: none
- download: current
patterns: $(PackageDownloadPatterns)
displayName: Download build artifact
- task: DotNetCoreCLI@2
displayName: 'push package to nuget.org'
inputs:
command: custom
custom: nuget
arguments: 'push $(packageGlob) -s https://api.nuget.org/v3/index.json --api-key $(NuGetApiKey)'