-
Notifications
You must be signed in to change notification settings - Fork 0
/
az-build-and-release-pipeline.yaml
158 lines (140 loc) · 4.89 KB
/
az-build-and-release-pipeline.yaml
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
trigger:
# start a new build for every push if false (default)
batch: true
branches:
# the build pipeline will be triggered for the following branches only
include:
- master
- develop
- feature/*
paths:
# the build pipeline will be triggered when a change is observed in following directories/files
include:
- src/*
- az-build-and-release-pipeline.yaml
pool:
vmImage: ubuntu-20.04
variables:
# Directory that contains our code
codeDirectory: $(Build.SourcesDirectory)/src
# Extension information
extensionId: "Global-Extension"
publisherId: "Biswajitr"
extensionName: "Global Extension"
artifactName: "Global-Extension"
shareWithOrganization: "Biswajitr,TCSTechCommWorkshop"
shareWithOrganization.URLs: "https://dev.azure.com/biswajitr,https://dev.azure.com/TCSTechCommWorkshop"
marketplaceServiceConnectionName: "Extension-Marketplace"
stages:
- stage: Test
displayName: Test
jobs:
- job: Test
steps:
- bash: make ni
displayName: Install Dependencies
- bash: make t
displayName: Run tests
- stage: Package
displayName: Package
dependsOn: [ Test ]
jobs:
- job: Package
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- task: TfxInstaller@3
inputs:
version: 'v0.9.x'
- task: Npm@1
inputs:
command: 'install'
workingDir: $(codeDirectory)
- task: Npm@1
inputs:
command: 'custom'
workingDir: $(codeDirectory)
customCommand: 'run restore'
- bash: rm -fv $(codeDirectory)/**/*.spec.ts
displayName: Remove typescript test files
workingDirectory: $(codeDirectory)
- bash: tsc
displayName: Run tsc in $(codeDirectory)
workingDirectory: $(codeDirectory)
- bash: rm -fv $(codeDirectory)/**/*.ts
displayName: Remove typescript files
workingDirectory: $(codeDirectory)
- task: PackageAzureDevOpsExtension@3
inputs:
rootFolder: '$(codeDirectory)'
outputPath: '$(Build.ArtifactStagingDirectory)/Extension'
publisherId: '$(publisherId)'
extensionId: '$(extensionId)'
extensionName: '$(extensionName)'
updateTasksVersion: true
updateTasksId: true
extensionVisibility: 'private'
extensionPricing: 'free'
- task: PublishPipelineArtifact@1
displayName: Publish artifact $(artifactName)
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/Extension'
artifactName: '$(artifactName)'
- stage: Release
displayName: Production
dependsOn: [ Test, Package ]
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
jobs:
- job: Release
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: $(artifactName)
targetPath: '$(Pipeline.Workspace)/Extension'
- task: TfxInstaller@3
inputs:
version: 'v0.9.x'
- task: PublishAzureDevOpsExtension@3
displayName: Publish Extension to marketplace
inputs:
connectTo: 'VsTeam'
connectedServiceName: $(marketplaceServiceConnectionName)
fileType: 'vsix'
vsixFile: '$(Pipeline.Workspace)/Extension/*.vsix'
publisherId: $(publisherId)
extensionId: $(extensionId)
extensionName: $(extensionName)
extensionVersion: '1.$(Build.BuildNumber)'
updateTasksVersion: true
updateTasksVersionType: 'minor'
extensionVisibility: 'private'
extensionPricing: 'free'
- task: ShareAzureDevOpsExtension@3
inputs:
connectTo: 'VsTeam'
connectedServiceName: $(marketplaceServiceConnectionName)
method: 'id'
publisherId: '$(publisherId)'
extensionId: '$(extensionId)'
accounts: '$(shareWithOrganization)'
- stage: Install
displayName: Install Extension in ORG
dependsOn: [ Release ]
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
jobs:
- job: Install
displayName: Install Extension in Org
steps:
- task: TfxInstaller@3
inputs:
version: 'v0.9.x'
- task: InstallAzureDevOpsExtension@3
displayName: Install Extension from marketplace
inputs:
connectTo: 'VsTeam'
connectedServiceName: $(marketplaceServiceConnectionName)
publisherId: $(publisherId)
extensionId: $(extensionId)
accounts: $(shareWithOrganization.URLs)