-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathvscode-powershell-Official.yml
221 lines (216 loc) · 8.12 KB
/
vscode-powershell-Official.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
#################################################################################
# OneBranch Pipelines #
# This pipeline was created by EasyStart from a sample located at: #
# https://aka.ms/obpipelines/easystart/samples #
# Documentation: https://aka.ms/obpipelines #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Retail Tasks: https://aka.ms/obpipelines/tasks #
# Support: https://aka.ms/onebranchsup #
#################################################################################
trigger: none
parameters:
- name: debug
displayName: Enable debug output
type: boolean
default: false
variables:
system.debug: ${{ parameters.debug }}
BuildConfiguration: Release
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
- repository: PowerShellEditorServices
type: git
name: PowerShellEditorServices
ref: release
pipelines:
- pipeline: PowerShellEditorServices-Official
source: PowerShellEditorServices-Official
trigger:
branches:
- release
extends:
# https://aka.ms/obpipelines/templates
template: v2/OneBranch.Official.CrossPlat.yml@templates
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
forStages: [build]
stages:
- stage: build
jobs:
- job: main
displayName: Build package
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- pwsh: |
$version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
Write-Output "##vso[task.setvariable variable=vsixVersion;isOutput=true]$version"
$prerelease = ([semver]$version).Minor % 2 -ne 0
if ($prerelease) { $version += "-preview" }
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$prerelease"
name: package
displayName: Get version from package.json
- task: onebranch.pipeline.version@1
displayName: Set OneBranch version
inputs:
system: Custom
customVersion: $(package.version)
- task: UseNode@1
displayName: Use Node 18.x
inputs:
version: 18.x
- task: npmAuthenticate@0
displayName: Authenticate NPM with Azure Artifacts
inputs:
workingFile: .npmrc
- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: tools/installPSResources.ps1
- task: DownloadPipelineArtifact@2
displayName: Download PowerShellEditorServices
inputs:
source: specific
project: PowerShellCore
definition: 2905
specificBuildWithTriggering: true
artifact: drop_release_github
itemPattern: PowerShellEditorServices.zip
- task: ExtractFiles@1
displayName: Extract PowerShellEditorServices module
inputs:
archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip
destinationFolder: $(Build.SourcesDirectory)/modules
- pwsh: Invoke-Build Build -Configuration $(BuildConfiguration)
displayName: Build
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party extension files
inputs:
command: sign
signing_environment: external_distribution
search_root: $(Build.SourcesDirectory)/dist
files_to_sign: '**/*.js'
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party example files
inputs:
command: sign
signing_environment: external_distribution
search_root: $(Build.SourcesDirectory)/examples
files_to_sign: '**/*.js;**/*.ps1;**/*.psd1;**/*.psm1'
- pwsh: Invoke-Build Package
displayName: Create package
- job: test
displayName: Build and run tests
pool:
type: windows
isCustom: true
name: Azure Pipelines
vmImage: windows-latest
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
skipComponentGovernanceDetection: true
steps:
- checkout: self
- checkout: PowerShellEditorServices
- task: UseNode@1
displayName: Use Node 18.x
inputs:
version: 18.x
- task: npmAuthenticate@0
displayName: Authenticate NPM with Azure Artifacts
inputs:
workingFile: vscode-powershell/.npmrc
- task: UseDotNet@2
displayName: Use .NET 8.x SDK
inputs:
packageType: sdk
version: 8.x
- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: vscode-powershell/tools/installPSResources.ps1
- pwsh: Invoke-Build Test -Configuration $(BuildConfiguration)
displayName: Run tests
workingDirectory: vscode-powershell
- stage: release
dependsOn: build
variables:
version: $[ stageDependencies.build.main.outputs['package.version'] ]
vsixVersion: $[ stageDependencies.build.main.outputs['package.vsixVersion'] ]
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
drop: $(Pipeline.Workspace)/drop_build_main
jobs:
- job: github
displayName: Publish draft to GitHub
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: GitHubRelease@1
displayName: Create GitHub release
inputs:
gitHubConnection: GitHub
repositoryName: PowerShell/vscode-powershell
assets: $(drop)/vscode-powershell-$(vsixVersion).vsix
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
isPreRelease: $(prerelease)
addChangeLog: false
releaseNotesSource: inline
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
- job: validation
displayName: Manual validation
pool:
type: agentless
timeoutInMinutes: 1440
steps:
- task: ManualValidation@0
displayName: Wait 24 hours for validation
inputs:
notifyUsers: $(Build.RequestedForEmail)
instructions: Please validate the release and then publish it!
timeoutInMinutes: 1440
- job: vscode
dependsOn: validation
displayName: Publish to VS Code Marketplace
pool:
type: windows
variables:
- group: VSCodeMarketplace
- name: ob_outputDirectory
value: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: npmAuthenticate@0
displayName: Install NPM packages (for vsce)
inputs:
workingFile: .npmrc
- pwsh: npm ci
displayName: Install NPM packages (for vsce)
- pwsh: |
$publishArgs = @(
'--pat'
'$(token)'
'--packagePath'
'$(drop)/vscode-powershell-$(vsixVersion).vsix'
if ([bool]::Parse('$(prerelease)')) { '--pre-release' }
)
npm run publish -- @publishArgs
displayName: Run vsce publish