@@ -18,18 +18,29 @@ parameters:
18
18
19
19
variables :
20
20
system.debug : ${{ parameters.debug }}
21
+ BuildConfiguration : Release
21
22
WindowsContainerImage : onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
22
23
23
24
resources :
24
- repositories :
25
+ repositories :
25
26
- repository : templates
26
27
type : git
27
28
name : OneBranch.Pipelines/GovernedTemplates
28
29
ref : refs/heads/main
30
+ - repository : PowerShellEditorServices
31
+ type : git
32
+ name : PowerShellEditorServices
33
+ ref : release
34
+ pipelines :
35
+ - pipeline : PowerShellEditorServices-Official
36
+ source : PowerShellEditorServices-Official
37
+ trigger :
38
+ branches :
39
+ - release
29
40
30
41
extends :
31
42
# https://aka.ms/obpipelines/templates
32
- template : v2/OneBranch.Official.CrossPlat.yml@templates
43
+ template : v2/OneBranch.Official.CrossPlat.yml@templates
33
44
parameters :
34
45
globalSdl : # https://aka.ms/obpipelines/sdl
35
46
asyncSdl :
@@ -45,7 +56,13 @@ extends:
45
56
variables :
46
57
ob_outputDirectory : $(Build.SourcesDirectory)/out
47
58
steps :
48
- - pwsh : Write-Output "##vso[task.setvariable variable=version;isOutput=true]$((Get-Content -Raw -Path package.json | ConvertFrom-Json).version)"
59
+ - pwsh : |
60
+ $version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
61
+ Write-Output "##vso[task.setvariable variable=vsixVersion;isOutput=true]$version"
62
+ $prerelease = ([semver]$version).Minor % 2 -ne 0
63
+ if ($prerelease) { $version += "-preview" }
64
+ Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
65
+ Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$prerelease"
49
66
name: package
50
67
displayName: Get version from package.json
51
68
- task : onebranch.pipeline.version@1
@@ -61,18 +78,42 @@ extends:
61
78
displayName : Authenticate NPM with Azure Artifacts
62
79
inputs :
63
80
workingFile : .npmrc
64
- - pwsh : npm ci
65
- displayName : Install NPM packages
66
- - pwsh : npm run compile -- --minify
67
- displayName : Build minified extension
81
+ - task : PowerShell@2
82
+ displayName : Install PSResources
83
+ inputs :
84
+ pwsh : true
85
+ filePath : tools/installPSResources.ps1
86
+ - task : DownloadPipelineArtifact@2
87
+ displayName : Download PowerShellEditorServices
88
+ inputs :
89
+ source : specific
90
+ project : PowerShellCore
91
+ definition : 2905
92
+ specificBuildWithTriggering : true
93
+ artifact : drop_release_github
94
+ itemPattern : PowerShellEditorServices.zip
95
+ - task : ExtractFiles@1
96
+ displayName : Extract PowerShellEditorServices module
97
+ inputs :
98
+ archiveFilePatterns : $(Pipeline.Workspace)/PowerShellEditorServices.zip
99
+ destinationFolder : $(Build.SourcesDirectory)/modules
100
+ - pwsh : Invoke-Build Build -Configuration $(BuildConfiguration)
101
+ displayName : Build
68
102
- task : onebranch.pipeline.signing@1
69
- displayName : Sign 1st-party files
103
+ displayName : Sign 1st-party extension files
70
104
inputs :
71
105
command : sign
72
106
signing_environment : external_distribution
73
107
search_root : $(Build.SourcesDirectory)/dist
74
- files_to_sign : extension.js
75
- - pwsh : New-Item -ItemType Directory -Force out && npm run package -- --out out/
108
+ files_to_sign : ' **/*.js'
109
+ - task : onebranch.pipeline.signing@1
110
+ displayName : Sign 1st-party example files
111
+ inputs :
112
+ command : sign
113
+ signing_environment : external_distribution
114
+ search_root : $(Build.SourcesDirectory)/examples
115
+ files_to_sign : ' **/*.js;**/*.ps1;**/*.psd1;**/*.psm1'
116
+ - pwsh : Invoke-Build Package
76
117
displayName : Create package
77
118
- job : test
78
119
displayName : Build and run tests
@@ -85,38 +126,38 @@ extends:
85
126
ob_outputDirectory : $(Build.SourcesDirectory)/out
86
127
skipComponentGovernanceDetection : true
87
128
steps :
129
+ - checkout : self
130
+ - checkout : PowerShellEditorServices
88
131
- task : UseNode@1
89
132
displayName : Use Node 18.x
90
133
inputs :
91
134
version : 18.x
92
135
- task : npmAuthenticate@0
93
136
displayName : Authenticate NPM with Azure Artifacts
94
137
inputs :
95
- workingFile : .npmrc
96
- - pwsh : npm ci
97
- displayName : Install NPM packages
98
- - pwsh : npm run test
138
+ workingFile : vscode-powershell/.npmrc
139
+ - task : UseDotNet@2
140
+ displayName : Use .NET 8.x SDK
141
+ inputs :
142
+ packageType : sdk
143
+ version : 8.x
144
+ - task : PowerShell@2
145
+ displayName : Install PSResources
146
+ inputs :
147
+ pwsh : true
148
+ filePath : vscode-powershell/tools/installPSResources.ps1
149
+ - pwsh : Invoke-Build Test -Configuration $(BuildConfiguration)
99
150
displayName : Run tests
151
+ workingDirectory : vscode-powershell
100
152
- stage : release
101
153
dependsOn : build
102
154
variables :
103
155
version : $[ stageDependencies.build.main.outputs['package.version'] ]
156
+ vsixVersion : $[ stageDependencies.build.main.outputs['package.vsixVersion'] ]
157
+ prerelease : $[ stageDependencies.build.main.outputs['package.prerelease'] ]
104
158
drop : $(Pipeline.Workspace)/drop_build_main
105
159
jobs :
106
- - job : validation
107
- displayName : Manual validation
108
- pool :
109
- type : agentless
110
- timeoutInMinutes : 1440
111
- steps :
112
- - task : ManualValidation@0
113
- displayName : Wait 24 hours for validation
114
- inputs :
115
- notifyUsers : $(Build.RequestedForEmail)
116
- instructions : Please validate the release
117
- timeoutInMinutes : 1440
118
160
- job : github
119
- dependsOn : validation
120
161
displayName : Publish draft to GitHub
121
162
pool :
122
163
type : windows
@@ -129,15 +170,27 @@ extends:
129
170
displayName : Create GitHub release
130
171
inputs :
131
172
gitHubConnection : GitHub
132
- repositoryName : microsoft /vscode-azurearcenabledmachines
133
- assets : $(drop)/vscode-azurearcenabledmachines -$(version ).vsix
173
+ repositoryName : PowerShell /vscode-powershell
174
+ assets : $(drop)/vscode-powershell -$(vsixVersion ).vsix
134
175
tagSource : userSpecifiedTag
135
176
tag : v$(version)
136
177
isDraft : true
178
+ isPreRelease : $(prerelease)
137
179
addChangeLog : false
138
180
releaseNotesSource : inline
139
- releaseNotesInline : |
140
- # TODO: Generate release notes on GitHub!
181
+ releaseNotesInline : " <!-- TODO: Generate release notes on GitHub! -->"
182
+ - job : validation
183
+ displayName : Manual validation
184
+ pool :
185
+ type : agentless
186
+ timeoutInMinutes : 1440
187
+ steps :
188
+ - task : ManualValidation@0
189
+ displayName : Wait 24 hours for validation
190
+ inputs :
191
+ notifyUsers : $(Build.RequestedForEmail)
192
+ instructions : Please validate the release and then publish it!
193
+ timeoutInMinutes : 1440
141
194
- job : vscode
142
195
dependsOn : validation
143
196
displayName : Publish to VS Code Marketplace
@@ -156,5 +209,13 @@ extends:
156
209
workingFile : .npmrc
157
210
- pwsh : npm ci
158
211
displayName : Install NPM packages (for vsce)
159
- - pwsh : npm run publish -- --pat $(token) --packagePath $(drop)/vscode-azurearcenabledmachines-$(version).vsix
212
+ - pwsh : |
213
+ $publishArgs = @(
214
+ '--pat'
215
+ '$(token)'
216
+ '--packagePath'
217
+ '$(drop)/vscode-powershell-$(vsixVersion).vsix'
218
+ if ([bool]::Parse('$(prerelease)')) { '--pre-release' }
219
+ )
220
+ npm run publish -- @publishArgs
160
221
displayName: Run vsce publish
0 commit comments