-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
252 lines (227 loc) · 11.4 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
vmPool: 'windows-latest'
majorVersion: 3
minorVersion: 0
patchVersion: 1
version: $[format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion)]
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
# Versioning: 1.0.0
releaseOnGithub: true
semVersion: $[format('{0}', variables.version)]
buildName: $[format('{0}', variables.semVersion)]
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}:
# Versioning: 1.0.0-develop.123
releaseOnGithub: false
semVersionBase: $[format('{0}-develop', variables.version)]
semVersionRev: $[counter(variables.semVersionBase, 0)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Develop - {0}', variables.semVersion)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/release/') }}:
# Versioning: 1.0.0-alpha.branch.123
releaseOnGithub: false
semVersionBase: $[format('{0}-alpha.{1}', variables.version, variables['Build.SourceBranchName'])]
semVersionRev: $[counter(variables.semVersionBase, 0)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Release - {0}', variables.semVersion)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/') }}:
# Versioning: 1.0.0-feature.branch.123
releaseOnGithub: false
semVersionBase: $[format('{0}-feature.{1}', variables.version, variables['Build.SourceBranchName'])]
semVersionRev: $[counter(variables.semVersionBase, 0)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Feature - {0}', variables.semVersion)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}: # Pull requests
# Versioning: 1.0.0-pr.1.123
releaseOnGithub: false
semVersionBase: $[format('{0}-pr.{1}', variables.version, variables['System.PullRequest.PullRequestId'])]
semVersionRev: $[counter(variables.semVersionBase, 0)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Pull Request - {0}', variables.semVersion)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/bugfix/') }}:
# Versioning: 1.0.0-bugfix.branch.123
releaseOnGithub: false
semVersionBase: $[format('{0}-bugfix.{1}', variables.version, variables['Build.SourceBranchName'])]
semVersionRev: $[counter(variables.semVersionBase, 0)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Bugfix - {0}', variables.semVersion)]
name: $(BuildID) - $(buildName)
trigger:
branches:
include:
- master
- develop
- release/*
- feature/*
- bugfix/*
- hotfix/*
paths:
exclude:
- README.md
- CHANGELOG.md
- docs/*
pr:
branches:
include:
- master
- develop
- release/*
paths:
exclude:
- README.md
- CHANGELOG.md
- docs/*
stages:
- stage: Build
displayName: Build
pool:
vmImage: $(vmPool)
jobs:
- job: BuildCLi
displayName: Build CLI
steps:
- task: DotNetCoreCLI@2
displayName: Dotnet build
inputs:
command: build
projects: 'Enterspeed.Cli.sln'
arguments: '--configuration Release /p:Version=$(semVersion)'
- task: DotNetCoreCLI@2
displayName: Dotnet test
inputs:
command: test
arguments: '--no-build --configuration Release'
- job: PublishWinx64Artifact
displayName: Publish win-x64 artifact
dependsOn: BuildCLi
steps:
- task: DotNetCoreCLI@2
displayName: win-x64 - Dotnet publish
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enterspeed.Cli/Enterspeed.Cli.csproj'
arguments: '-c Release -r win-x64 -p:PublishReadyToRun=true -p:Version=$(semVersion) --self-contained -o $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_win-x64'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: win-x64 - zip
inputs:
targetType: 'inline'
script: '& 7z.exe a -tzip $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_win-x64.zip $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_win-x64/es-cli.exe'
- task: PublishPipelineArtifact@1
displayName: win-x64 - Publish artifact
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_win-x64.zip"
artifact: 'es-cli_$(semVersion)_win-x64'
- job: PublishLinuxx64Artifact
displayName: Publish linux-x64 artifact
dependsOn: BuildCLi
steps:
- task: DotNetCoreCLI@2
displayName: linux-x64 - Dotnet publish
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enterspeed.Cli/Enterspeed.Cli.csproj'
arguments: '-c Release -r linux-x64 -p:PublishReadyToRun=true -p:Version=$(semVersion) --self-contained -o $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_linux-x64'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: linux-x64 - gzip
inputs:
targetType: 'inline'
script: '& 7z.exe a -tgzip $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_linux-x64.gz $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_linux-x64/es-cli'
- task: PublishPipelineArtifact@1
displayName: linux-x64 - Publish artifact
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_linux-x64.gz"
artifact: 'es-cli_$(semVersion)_linux-x64'
- job: PublishOsxx64Artifact
displayName: Publish osx-x64 artifact
dependsOn: BuildCLi
steps:
- task: DotNetCoreCLI@2
displayName: osx-x64 - Dotnet publish
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enterspeed.Cli/Enterspeed.Cli.csproj'
arguments: '-c Release -r osx-x64 -p:PublishReadyToRun=true -p:Version=$(semVersion) --self-contained -o $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-x64'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: osx-x64 - gzip
inputs:
targetType: 'inline'
script: '& 7z.exe a -tgzip $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-x64.gz $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-x64/es-cli'
- task: PublishPipelineArtifact@1
displayName: osx-x64 - Publish artifact
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-x64.gz"
artifact: 'es-cli_$(semVersion)_osx-x64'
- job: PublishOsxarm64Artifact
displayName: Publish osx-arm64 artifact
dependsOn: BuildCLi
steps:
- task: DotNetCoreCLI@2
displayName: osx-arm64 - Dotnet publish
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enterspeed.Cli/Enterspeed.Cli.csproj'
arguments: '-c Release -r osx-arm64 -p:PublishReadyToRun=true -p:Version=$(semVersion) --self-contained -o $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-arm64'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: osx-arm64 - gzip
inputs:
targetType: 'inline'
script: '& 7z.exe a -tgzip $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-arm64.gz $(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-arm64/es-cli'
- task: PublishPipelineArtifact@1
displayName: osx-arm64 - Publish artifact
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/Output/es-cli_$(semVersion)_osx-arm64.gz"
artifact: 'es-cli_$(semVersion)_osx-arm64'
- stage: ReleaseOnGithub
displayName: Release on Github
pool:
vmImage: $(vmPool)
condition: and(succeeded(), eq(variables.releaseOnGithub, 'true'))
jobs:
- job:
displayName: Create release on Github
steps:
- checkout: self
persistCredentials: true
clean: true
fetchDepth: 1
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
cleanDestinationFolder: true
- task: GitHubRelease@1
inputs:
gitHubConnection: GithubReleaseCli
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
#tagPattern: # string. Optional. Use when tagSource = gitTag. Tag Pattern.
tag: '$(semVersion)'
#title: # string. Optional. Use when action = create || action = edit. Release title.
releaseNotesSource: 'filePath' # 'filePath' | 'inline'. Optional. Use when action = create || action = edit. Release notes source. Default: filePath.
releaseNotesFilePath: '$(Build.SourcesDirectory)/releaseNotes/$(semVersion).md' # string. Optional. Use when releaseNotesSource = filePath. Release notes file path.
#releaseNotesInline: # string. Optional. Use when releaseNotesSource = inline. Release notes.
assets: '$(System.ArtifactsDirectory)/**'
#assetUploadMode: 'delete' # 'delete' | 'replace'. Optional. Use when action = edit. Asset upload mode. Default: delete.
#isDraft: false # boolean. Optional. Use when action = create || action = edit. Draft release. Default: false.
#isPreRelease: false # boolean. Optional. Use when action = create || action = edit. Pre-release. Default: false.
addChangeLog: false # boolean. Optional. Use when action = create || action = edit. Add changelog. Default: true.
# Changelog configuration
#changeLogCompareToRelease: 'lastFullRelease' # 'lastFullRelease' | 'lastNonDraftRelease' | 'lastNonDraftReleaseByTag'. Required when addChangeLog = true. Compare to. Default: lastFullRelease.
#changeLogCompareToReleaseTag: # string. Required when changeLogCompareToRelease = lastNonDraftReleaseByTag. Release Tag.
#changeLogType: 'commitBased' # 'commitBased' | 'issueBased'. Required when addChangeLog = true. Changelog type. Default: commitBased.
#changeLogLabels: '[{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }]' # string. Optional. Use when changeLogType = issueBased. Categories. Default: [{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }].