Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
},
"git.branchProtection": ["main"],
"git.branchRandomName.enable": true,
}
"python-envs.defaultEnvManager": "ms-python.python:system",
"python-envs.pythonProjects": []
}
7 changes: 7 additions & 0 deletions build/templates/publish-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ jobs:
}

$package = Get-Content $packageJsonPath -Raw | ConvertFrom-Json
$enabledApiProposals = @()
if ($null -ne $package.enabledApiProposals) {
$enabledApiProposals = @($package.enabledApiProposals)
}
$enabledApiProposalsJson = ($enabledApiProposals | ConvertTo-Json -Compress)
Write-Host "##vso[task.setvariable variable=EnabledApiProposalsJson]$enabledApiProposalsJson"
Write-Host ("enabledApiProposals: " + ($(if ($enabledApiProposals.Count -gt 0) { $enabledApiProposals -join ', ' } else { '<none>' })))
Write-Host "##vso[task.setvariable variable=publisher;isOutput=true]$($package.publisher)"
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$($package.version)"
name: SetPublisherAndVersion
Expand Down
35 changes: 31 additions & 4 deletions build/templates/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,41 @@ steps:
Write-Host "Listing platform folder contents:"
Get-ChildItem $root | Select-Object Name,Length | Format-Table -AutoSize

# If the extension uses proposed APIs, vsce requires explicitly allowing them.
# We expect EnabledApiProposalsJson to be set by an earlier step (e.g. publish-extension.yml).
$allowProposedApisArgs = @()
$enabledApiProposalsJson = "$(EnabledApiProposalsJson)"
if (-not $enabledApiProposalsJson -or ($enabledApiProposalsJson -match '^\$\(')) {
Write-Host "EnabledApiProposalsJson is not set; publishing without --allow-proposed-apis."
} else {
try {
$enabledApiProposals = @($enabledApiProposalsJson | ConvertFrom-Json)
if ($enabledApiProposals.Count -gt 0) {
Write-Host ("enabledApiProposals (from EnabledApiProposalsJson): " + ($enabledApiProposals -join ', '))
$allowProposedApisArgs = @('--allow-proposed-apis') + @($enabledApiProposals)
} else {
Write-Host "EnabledApiProposalsJson parsed as empty; no proposed API allowlist flags needed."
}
} catch {
Write-Host "EnabledApiProposalsJson was set but could not be parsed; publishing without --allow-proposed-apis."
}
}

if ('${{ parameters.preRelease }}' -eq 'True') {
Write-Host 'Publishing as pre-release'
Write-Host "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --pre-release"
npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --pre-release
$allowProposedApisDisplay = ($allowProposedApisArgs -join ' ')
$displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath"
if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" }
$displayCmd += ' --pre-release'
Write-Host $displayCmd
npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release
} else {
Write-Host 'Publishing as stable release'
Write-Host "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath"
npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath
$allowProposedApisDisplay = ($allowProposedApisArgs -join ' ')
$displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath"
if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" }
Write-Host $displayCmd
npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs
}

if ($LASTEXITCODE -ne 0) {
Expand Down
Loading