@@ -18,18 +18,29 @@ parameters:
1818
1919variables :
2020 system.debug : ${{ parameters.debug }}
21+ BuildConfiguration : Release
2122 WindowsContainerImage : onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
2223
2324resources :
24- repositories :
25+ repositories :
2526 - repository : templates
2627 type : git
2728 name : OneBranch.Pipelines/GovernedTemplates
2829 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
2940
3041extends :
3142 # https://aka.ms/obpipelines/templates
32- template : v2/OneBranch.Official.CrossPlat.yml@templates
43+ template : v2/OneBranch.Official.CrossPlat.yml@templates
3344 parameters :
3445 globalSdl : # https://aka.ms/obpipelines/sdl
3546 asyncSdl :
@@ -45,7 +56,13 @@ extends:
4556 variables :
4657 ob_outputDirectory : $(Build.SourcesDirectory)/out
4758 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"
4966 name: package
5067 displayName: Get version from package.json
5168 - task : onebranch.pipeline.version@1
@@ -61,18 +78,42 @@ extends:
6178 displayName : Authenticate NPM with Azure Artifacts
6279 inputs :
6380 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
68102 - task : onebranch.pipeline.signing@1
69- displayName : Sign 1st-party files
103+ displayName : Sign 1st-party extension files
70104 inputs :
71105 command : sign
72106 signing_environment : external_distribution
73107 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
76117 displayName : Create package
77118 - job : test
78119 displayName : Build and run tests
@@ -85,38 +126,38 @@ extends:
85126 ob_outputDirectory : $(Build.SourcesDirectory)/out
86127 skipComponentGovernanceDetection : true
87128 steps :
129+ - checkout : self
130+ - checkout : PowerShellEditorServices
88131 - task : UseNode@1
89132 displayName : Use Node 18.x
90133 inputs :
91134 version : 18.x
92135 - task : npmAuthenticate@0
93136 displayName : Authenticate NPM with Azure Artifacts
94137 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)
99150 displayName : Run tests
151+ workingDirectory : vscode-powershell
100152 - stage : release
101153 dependsOn : build
102154 variables :
103155 version : $[ stageDependencies.build.main.outputs['package.version'] ]
156+ vsixVersion : $[ stageDependencies.build.main.outputs['package.vsixVersion'] ]
157+ prerelease : $[ stageDependencies.build.main.outputs['package.prerelease'] ]
104158 drop : $(Pipeline.Workspace)/drop_build_main
105159 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
118160 - job : github
119- dependsOn : validation
120161 displayName : Publish draft to GitHub
121162 pool :
122163 type : windows
@@ -129,15 +170,27 @@ extends:
129170 displayName : Create GitHub release
130171 inputs :
131172 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
134175 tagSource : userSpecifiedTag
135176 tag : v$(version)
136177 isDraft : true
178+ isPreRelease : $(prerelease)
137179 addChangeLog : false
138180 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
141194 - job : vscode
142195 dependsOn : validation
143196 displayName : Publish to VS Code Marketplace
@@ -156,5 +209,13 @@ extends:
156209 workingFile : .npmrc
157210 - pwsh : npm ci
158211 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
160221 displayName: Run vsce publish
0 commit comments