-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines-u9+.yml
173 lines (162 loc) · 6.5 KB
/
azure-pipelines-u9+.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
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
majorVersion: 4
minorVersion: 2
patchVersion: 2
version: $[format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion)]
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
# Versioning: 1.0.0
releaseOnNuget: 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
releaseOnNuget: 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
releaseOnNuget: 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
releaseOnNuget: 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
releaseOnNuget: 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
releaseOnNuget: 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)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/prerelease/') }}:
# Versioning: 1.0.0-alpha.123
releaseOnNuget: true
semVersionBase: $[format('{0}-alpha', variables.version)]
semVersionRev: $[counter(variables.semVersionBase, 1)]
semVersion: $[format('{0}.{1}', variables.semVersionBase, variables.semVersionRev)]
buildName: $[format('Prerelease - {0}', variables.semVersion)]
name: $(BuildID) - $(buildName)
trigger:
branches:
include:
- master
- develop
- release/*
- feature/*
- bugfix/*
- hotfix/*
paths:
exclude:
- README.md
- CHANGELOG.md
- documentation/*
- src/Enterspeed.Source.UmbracoCms.V7/*
- src/Enterspeed.Source.UmbracoCms.V8/*
- src/Enterspeed.Source.UmbracoCms.V14Plus/*
- azure-pipelines-u7-u8.yml
- azure-pipelines-u14+.yml
pr:
branches:
include:
- master
- develop
- release/*
paths:
exclude:
- README.md
- CHANGELOG.md
- documentation/*
- src/Enterspeed.Source.UmbracoCms.V7/*
- src/Enterspeed.Source.UmbracoCms.V8/*
- src/Enterspeed.Source.UmbracoCms.V14Plus/*
- Enterspeed.Source.UmbracoCms.netframework.sln
- Enterspeed.Source.UmbracoCms.V14Plus.sln
- azure-pipelines-u7-u8.yml
- azure-pipelines-u14+.yml
stages:
- stage: Build
displayName: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
# Restore packages
- task: DotNetCoreCLI@2
displayName: Dotnet restore
inputs:
command: restore
projects: "./Enterspeed.Source.UmbracoCms.V9Plus.sln"
feedsToUse: config
nugetConfigPath: "$(System.DefaultWorkingDirectory)/NuGet.Config"
# Build solution
- task: DotNetCoreCLI@2
displayName: Dotnet build
inputs:
command: build
projects: "Enterspeed.Source.UmbracoCms.V9Plus.sln"
arguments: "--no-restore --configuration Release /p:Version=$(semVersion)"
# Pack NuGet
- task: DotNetCoreCLI@2
displayName: Dotnet pack
inputs:
command: pack
outputDir: "$(Build.ArtifactStagingDirectory)/NuGet"
packagesToPack: "src/Enterspeed.Source.UmbracoCms.V9Plus/*.csproj"
versioningScheme: byEnvVar
versionEnvVar: semVersion
# Publish artifacts
- task: PublishPipelineArtifact@1
displayName: Publish artifact - nupkg
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/NuGet"
artifact: nupkg
- stage: Release
displayName: Release
condition: and(succeeded(), eq(variables.releaseOnNuget, 'true'))
jobs:
- deployment: ReleaseNuGet
displayName: Release on NuGet.org
environment: NuGetOrg
pool:
vmImage: ubuntu-latest
strategy:
runOnce:
deploy:
steps:
- checkout: self
persistCredentials: true
clean: true
fetchDepth: 1
# Tag release in git
- task: Bash@3
displayName: Tag version in git
inputs:
targetType: inline
script: |
git tag $(semVersion)
git push --tags
- task: NuGetCommand@2
displayName: Release on NuGet.org
inputs:
command: push
packagesToPush: "$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg"
nuGetFeedType: external
publishFeedCredentials: NuGet.org