-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
183 lines (156 loc) · 4.95 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
resources:
- repo: self
parameters:
- name: makeDraftRelease
displayName: 'Create a draft release in GitHub?'
type: boolean
default: false
trigger:
batch: true
branches:
include: [ master ]
paths:
exclude:
- README.md
- tools
- BuildPreparation.ps1
- docs
pr:
autoCancel: true
branches:
include:
- master
paths:
exclude:
- README.md
- tools
- BuildPreparation.ps1
- docs
pool:
vmImage: windows-latest
variables:
outputDir: './dist'
sourcePath: './src'
PublisherName: 'RazorSPoint'
ExtensionId: '6524a597-31bc-44fc-895d-0e9ba50f2493'
SharedWith: 'razorspoint-trashdummy,razorspoint'
stages:
- stage: Build
jobs:
- job: Build_Extension
displayName: 'Build Extension'
steps:
- task: GitVersion@5
displayName: GitVersion
inputs:
runtime: 'core'
- template: YamlTemplates/unitTests.yml
parameters:
CodeCoverage: 'true'
- pwsh: '$(Build.SourcesDirectory)/tools/PrepareExtension.ps1 -sourcePath $(sourcePath) -outputDir $(outputDir)'
displayName: 'Merge Extension Files for Build'
- template: YamlTemplates/codeAnalysis.yml
- pwsh: "Tree $(outputDir) /f"
condition: always()
- task: TfxInstaller@2
inputs:
version: 'v0.7.x'
- task: PackageVSTSExtension@1
displayName: 'Package Extension'
inputs:
rootFolder: $(outputDir)
outputPath: '$(Build.ArtifactStagingDirectory)/package/'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: AzurepolicyTasks'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/package/'
ArtifactName: AzurepolicyTasks
- stage: Staging
jobs:
- deployment: Test_Release
displayName: 'Test Release'
environment: Marketplace
variables:
extensionTag: 'Preview'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: GitVersion@5
displayName: GitVersion
inputs:
runtime: 'core'
- task: ms-devlabs.vsts-developer-tools-build-tasks.tfx-installer-build-task.TfxInstaller@2
displayName: 'Install tfx-cli: v0.7.x'
inputs:
version: v0.7.x
- task: QueryAzureDevOpsExtensionVersion@2
name: PolicyVersion
inputs:
connectTo: 'VsTeam'
connectedServiceName: 'Marketplace Connection'
publisherId: '$(PublisherName)'
extensionId: '$(ExtensionId)'
extensionTag: $(extensionTag)
versionAction: 'Patch'
- task: ms-devlabs.vsts-developer-tools-build-tasks.publish-extension-build-task.PublishAzureDevOpsExtension@2
displayName: 'Publish Extension'
inputs:
connectedServiceName: 'Marketplace Connection'
fileType: vsix
vsixFile: '$(Build.StagingDirectory)/../AzurepolicyTasks/*.vsix'
publisherId: '$(PublisherName)'
extensionId: '$(ExtensionId)'
extensionTag: $(extensionTag)
extensionVersion: $(PolicyVersion.Extension.Version)
updateTasksId: true
extensionVisibility: privatepreview
extensionPricing: free
shareWith: '$(SharedWith)'
- ${{ if eq(parameters.makeDraftRelease, 'true') }}:
- deployment: GitHub_Preview
displayName: 'GitHub Preview'
environment: GitHub
dependsOn: Test_Release
strategy:
runOnce:
deploy:
steps:
- template: YamlTemplates/gitHubRelease.yml
parameters:
isDraft: true
- stage: Production
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: Public_Marketplace
displayName: 'Public Marketplace'
environment: Marketplace
strategy:
runOnce:
deploy:
steps:
- task: ms-devlabs.vsts-developer-tools-build-tasks.tfx-installer-build-task.TfxInstaller@2
displayName: 'Install tfx-cli: v0.7.x'
inputs:
version: v0.7.x
- task: ms-devlabs.vsts-developer-tools-build-tasks.publish-extension-build-task.PublishAzureDevOpsExtension@2
displayName: 'Publish Extension '
inputs:
connectedServiceName: 'Marketplace Connection'
fileType: vsix
vsixFile: '$(Build.StagingDirectory)/../AzurepolicyTasks/*.vsix'
publisherId: '$(PublisherName)'
updateTasksVersion: false
- stage: GitHub_Public
displayName: 'GitHub Public Release'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: GitHub_Release
displayName: 'GitHub Release'
environment: GitHub
strategy:
runOnce:
deploy:
steps:
- template: YamlTemplates/gitHubRelease.yml