@@ -155,7 +155,7 @@ function Update-Branch {
155155
156156<#
157157. SYNOPSIS
158- Gets current version from changelog as [semver].
158+ Gets current version from changelog as ` [semver]` .
159159#>
160160function Get-Version {
161161 param (
@@ -177,7 +177,7 @@ function Get-Version {
177177 Updates the CHANGELOG file with PRs merged since the last release.
178178. DESCRIPTION
179179 Uses the local Git repositories but does not pull, so ensure HEAD is where
180- you want it. Creates a new branch at ' release/$Version' if not already
180+ you want it. Creates a new branch at ` release/$Version` if not already
181181 checked out. Handles any merge option for PRs, but is a little slow as it
182182 queries all PRs.
183183#>
@@ -428,3 +428,42 @@ function New-DraftRelease {
428428 $Assets | New-GitHubReleaseAsset - Release $Release.Id
429429 }
430430}
431+
432+ <#
433+ . SYNOPSIS
434+ Uploads VSIX and PS1 binaries to their respective marketplaces.
435+ . DESCRIPTION
436+ The VSIX is uploaded to the Visual Studio Code Marketplace using the `vsce`
437+ tool and the `VsceToken` parameter:
438+ https://marketplace.visualstudio.com/VSCode
439+
440+ The PS1 is uploaded to the PowerShell Gallery using the `Publish-Script`
441+ cmdlet and the `GalleryToken` parameter: https://www.powershellgallery.com
442+
443+ This function is primarily used by ADO pipelines, but could be used manually.
444+ #>
445+ function Publish-Assets {
446+ param (
447+ [Parameter (Mandatory )]
448+ [string []]$Assets ,
449+
450+ [Parameter ()]
451+ [string ]$VsceToken ,
452+
453+ [Parameter ()]
454+ [string ]$GalleryToken
455+ )
456+ switch ($Assets ) {
457+ { $_.EndsWith (" .vsix" ) } {
458+ Write-Host " Uploading VSIX..."
459+ vsce publish -- packagePath $_ -- pat $VsceToken
460+ }
461+ { $_.EndsWith (" .ps1" ) } {
462+ Write-Host " Uploading PS1..."
463+ Publish-Script - Path $_ - NuGetApiKey $GalleryToken
464+ }
465+ default {
466+ Write-Error " Unsupported file: $_ "
467+ }
468+ }
469+ }
0 commit comments