Skip Store Publish when No Channel Seleceted (#27334)

Co-authored-by: Justin Chung <chungjustin@microsoft.com>
This commit is contained in:
Justin Chung
2026-06-02 15:39:18 -05:00
committed by GitHub
co-authored by Justin Chung
parent 96ab22e281
commit c23c421068
2 changed files with 27 additions and 8 deletions
+18 -3
View File
@@ -79,10 +79,24 @@ jobs:
$currentChannel = if ($IsLTS) { 'LTS' }
elseif ($IsStable) { 'Stable' }
elseif ($IsPreview) { 'Preview' }
else {
Write-Error "No valid channel detected"
exit 1
else { $null }
if (-not $currentChannel) {
Write-Host "##[warning]No release channel selected (LTS/Stable/Preview all false). Skipping Store package creation."
Write-Host "##vso[task.setvariable variable=SkipStorePublish]true"
# Set channel flags so any downstream conditioned tasks evaluate to skip.
Write-Host "##vso[task.setvariable variable=LTS]false"
Write-Host "##vso[task.setvariable variable=STABLE]false"
Write-Host "##vso[task.setvariable variable=PREVIEW]false"
# Ensure the output directory exists so downstream artifact publishing does not fail.
$outputDirectory = "$(ob_outputDirectory)"
if (-not (Test-Path -LiteralPath $outputDirectory)) {
New-Item -ItemType Directory -Path $outputDirectory -Force | Out-Null
}
return
}
Write-Host "##vso[task.setvariable variable=SkipStorePublish]false"
$config = $channelConfigs[$currentChannel]
Write-Verbose -Verbose "Selected channel: $currentChannel"
@@ -242,3 +256,4 @@ jobs:
exit 1
}
displayName: 'Upload StoreBroker Package'
condition: and(succeeded(), ne(variables['SkipStorePublish'], 'true'))
@@ -34,6 +34,7 @@ jobs:
displayName: 'Capture ReleaseTag and Downloaded Packages'
- task: PowerShell@2
condition: or(eq(variables['LTS'], 'true'), eq(variables['STABLE'], 'true'), eq(variables['PREVIEW'], 'true'))
inputs:
targetType: inline
script: |
@@ -70,12 +71,13 @@ jobs:
displayName: 'Add Changelog Link and Version Number to SBJSON'
- task: PowerShell@2
condition: or(eq(variables['LTS'], 'true'), eq(variables['STABLE'], 'true'), eq(variables['PREVIEW'], 'true'))
inputs:
targetType: inline
script: |
# Convert ADO variables to PowerShell boolean variables
$IsLTS = '$(LTS)' -eq 'true'
$IsStable = '$(STABLE)' -eq 'true'
$IsStable = '$(STABLE)' -eq 'true'
$IsPreview = '$(PREVIEW)' -eq 'true'
Write-Verbose -Verbose "Channel Selection - LTS: $(LTS), Stable: $(STABLE), Preview: $(PREVIEW)"
@@ -83,10 +85,12 @@ jobs:
$currentChannel = if ($IsLTS) { 'LTS' }
elseif ($IsStable) { 'Stable' }
elseif ($IsPreview) { 'Preview' }
else {
Write-Error "No valid channel detected"
exit 1
}
else { $null }
if (-not $currentChannel) {
Write-Host "##[warning]No release channel selected (LTS/Stable/Preview all false). Skipping Store publish."
return
}
# Assign AppID for Store-Publish Task
$appID = $null