@@ -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,22 +126,35 @@ 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
160
- job : validation
@@ -116,7 +170,7 @@ extends:
116
170
instructions : Please validate the release
117
171
timeoutInMinutes : 1440
118
172
- job : github
119
- dependsOn : validation
173
+ # TODO: dependsOn: validation
120
174
displayName : Publish draft to GitHub
121
175
pool :
122
176
type : windows
@@ -129,15 +183,15 @@ extends:
129
183
displayName : Create GitHub release
130
184
inputs :
131
185
gitHubConnection : GitHub
132
- repositoryName : microsoft /vscode-azurearcenabledmachines
133
- assets : $(drop)/vscode-azurearcenabledmachines -$(version ).vsix
186
+ repositoryName : PowerShell /vscode-powershell
187
+ assets : $(drop)/vscode-powershell -$(vsixVersion ).vsix
134
188
tagSource : userSpecifiedTag
135
189
tag : v$(version)
136
190
isDraft : true
191
+ isPreRelease : $(prerelease)
137
192
addChangeLog : false
138
193
releaseNotesSource : inline
139
- releaseNotesInline : |
140
- # TODO: Generate release notes on GitHub!
194
+ releaseNotesInline : " <!-- TODO: Generate release notes on GitHub! -->"
141
195
- job : vscode
142
196
dependsOn : validation
143
197
displayName : Publish to VS Code Marketplace
@@ -156,5 +210,13 @@ extends:
156
210
workingFile : .npmrc
157
211
- pwsh : npm ci
158
212
displayName : Install NPM packages (for vsce)
159
- - pwsh : npm run publish -- --pat $(token) --packagePath $(drop)/vscode-azurearcenabledmachines-$(version).vsix
213
+ - pwsh : |
214
+ $publishArgs = @(
215
+ '--pat'
216
+ '$(token)'
217
+ '--packagePath'
218
+ '$(drop)/vscode-powershell-$(vsixVersion).vsix'
219
+ if ([bool]::Parse('$(prerelease)')) { '--pre-release' }
220
+ )
221
+ npm run publish -- @publishArgs
160
222
displayName: Run vsce publish
0 commit comments