/
azure-pipelines.yml
178 lines (165 loc) · 6.2 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
name: $(Major).$(Minor).$(rev:r) # build numbering format
trigger:
branches:
include: [ main ] # branch names which will trigger a build
paths:
include: [ Extensions/ArtifactDescription ] # file paths which must match to trigger a build, cannot be a variable
pr: # will trigger on PR
branches:
include: [ main ] # branch names which will trigger a build
paths:
include: [ Extensions/ArtifactDescription ] # file paths which must match to trigger a build, cannot be a variable
variables:
# declared in the pipeline UI
# major
# minor
- group: 'ArtifactDescription Extension'
# this group includes the following variablea
# ExtensionRoot - working folder
# PublisherID - Marketplace publisher
# ExtensionID - Marketplace extension id
# vmImage - name of Azure DevOps pool to use
# artifactLocationName - folder the artifact to push is stored in
# privateExtentionsTag - tag to show if private (else blank)
# taskID - Marketplace ID of task
# wikiFilename - name of generated docs files
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: '$(vmImage)'
demands: npm
steps:
# version all the task in the extension
- task: qetza.replacetokens.replacetokens-task.replacetokens@6
displayName: 'Setting the version for tasks in extension'
inputs:
rootDirectory: '$(Build.SourcesDirectory)/$(ExtensionRoot)'
targetFiles: '**\\task.json'
# for each Node based task we must transpile it
- template: ..\..\YAMLTemplates\build-node-task.yml
parameters:
extensionRoot: '$(ExtensionRoot)'
taskName: 'ArtifactDescriptionTask'
- task: TfxInstaller@3
displayName: 'Install Tfx Tool'
inputs:
version: 'v0.8.x'
- task: ms-devlabs.vsts-developer-tools-build-tasks.package-extension-build-task.PackageVSTSExtension@3
displayName: 'Package and Publish Extension as a PROD Package '
inputs:
rootFolder: '$(ExtensionRoot)'
outputPath: '$(Build.ArtifactStagingDirectory)\\$(artifactLocationName)'
publisherId: '$(PublisherID)'
extensionId: '$(ExtensionID)'
extensionVersion: '$(Build.BuildNumber)'
updateTasksVersion: true
extensionVisibility: public
- task: CopyFiles@2
displayName: 'Copy Docs'
inputs:
SourceFolder: $(ExtensionRoot)
Contents: |
readme.md
vss-extension.json
**\task\task.json
TargetFolder: '$(Build.ArtifactStagingDirectory)\\$(artifactLocationName)'
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'vsix'
targetPath: '$(Build.ArtifactStagingDirectory)\\$(artifactLocationName)'
- stage: Private
jobs:
- deployment: Private_Deployment
timeoutInMinutes: 0
environment: 'Azure DevOps Marketplace (Private)'
pool:
vmImage: '$(vmImage)'
strategy:
runOnce:
deploy:
steps:
# we don't need to DownloadPipelineArtifact as this is done automatically
- template: ..\..\YAMLTemplates\publish-extension.yml
parameters:
vsixPath: '$(Agent.BuildDirectory)\\$(artifactLocationName)\\$(PublisherID).$(ExtensionID)-$(Build.BuildNumber).vsix'
extensionTag: '$(privateExtentionsTag)'
extensionVisibility: private
- stage: Test
dependsOn: Private
jobs:
- deployment: Private_Test
timeoutInMinutes: 0
environment: 'Azure DevOps Marketplace (ArtifactDescription)'
pool:
vmImage: '$(vmImage)'
strategy:
runOnce:
deploy:
steps:
- task: richardfennellBM.BM-VSTS-ArtifactDescription-Tasks-DEV.ArtifactDescriptionTask.ArtifactDescriptionTask@2
displayName: 'Get Git Artifact PR Reason'
inputs:
OutputText: 'OutputedText'
- bash: "echo 'The reason message is [$(OutputedText)]'"
- stage: Documentation
dependsOn: Test
variables:
- group: 'WIKI Updater'
# provides the variable
# gitemail - used in the Git Config
# gitName - used in the Git Config
# githubpat - used to authenticate to repo
# user - used to authenticate to repo
# repo - url of repo (without HTTPS://)
jobs:
- deployment: Documentation
timeoutInMinutes: 0
environment: 'Azure DevOps Marketplace (Documentation)'
pool:
vmImage: '$(vmImage)'
strategy:
runOnce:
deploy:
steps:
- template: ..\..\YAMLTemplates\generate-wiki-docs.yml
parameters:
workingDirectory: '$(Agent.BuildDirectory)/$(artifactLocationName)'
wikiFilename: '$(wikiFilename)'
repo: '$(repo)'
gitname: '$(GitName)'
gitemail: '$(GitEmail)'
UserName: '$(UserName)'
GitHubPat: '$(GitHubPat)'
- stage: Public
dependsOn: Documentation
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: Public_Deployment
timeoutInMinutes: 0
environment: 'Azure DevOps Marketplace (Public)'
pool:
vmImage: '$(vmImage)'
strategy:
runOnce:
deploy:
steps:
# we don't need to DownloadPipelineArtifact as this is done automatically
- template: ..\..\YAMLTemplates\publish-extension.yml
parameters:
vsixPath: '$(Agent.BuildDirectory)\\$(artifactLocationName)\\$(PublisherID).$(ExtensionID)-$(Build.BuildNumber).vsix'
extensionTag: ''
extensionVisibility: public
- job: Post_Publish
dependsOn: Public_Deployment
variables:
- group: socialMedia
pool:
vmImage: '$(vmImage)'
steps:
- template: ..\..\YAMLTemplates\post-publish.yml
parameters:
buildNumber: $(Build.BuildNumber)
extensionName: $(Build.DefinitionName)
socialmediaLogicAppURL: $(socialmediaLogicAppURL)