Skip to content

Commit d079276

Browse files
Merge branch 'master' into fix/hosting-api-bounded-waits
2 parents 0276a0e + 1e5c020 commit d079276

2 files changed

Lines changed: 29 additions & 14 deletions

File tree

‎.pipelines/templates/release-upload-buildinfo.yml‎

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ jobs:
5151
Import-Module "$toolsDirectory/ci.psm1"
5252
$jsonFile = Get-Item "$ENV:PIPELINE_WORKSPACE/PSPackagesOfficial/BuildInfoJson/*.json"
5353
$fileName = Split-Path $jsonFile -Leaf
54+
# The build itself has already determined if it is preview or stable/LTS,
55+
# we just need to check via the file name
56+
$isPreview = $fileName -eq "preview.json"
57+
$isStable = $fileName -eq "stable.json"
5458
5559
$dateTime = [datetime]::UtcNow
5660
$dateTime = [datetime]::new($dateTime.Ticks - ($dateTime.Ticks % [timespan]::TicksPerSecond), $dateTime.Kind)
5761
5862
$metadata = Get-Content -LiteralPath "$toolsDirectory/metadata.json" -ErrorAction Stop | ConvertFrom-Json
59-
$stableReleaseTag = $metadata.StableReleaseTag -Replace 'v',''
60-
61-
$currentReleaseTag = $buildInfo.ReleaseTag -Replace 'v',''
63+
# Note: version tags in metadata.json (e.g. StableReleaseTag) may not reflect the current release being
64+
# published, so they must not be used to gate channel decisions. Use the explicit publish flags instead.
6265
$stableRelease = $metadata.StableRelease.PublishToChannels
6366
$ltsRelease = $metadata.LTSRelease.PublishToChannels
6467
@@ -73,7 +76,7 @@ jobs:
7376
$targetFile = "$ENV:PIPELINE_WORKSPACE/$fileName"
7477
ConvertTo-Json -InputObject $buildInfo | Out-File $targetFile -Encoding ascii
7578
76-
if ($fileName -eq "preview.json") {
79+
if ($isPreview) {
7780
Set-BuildVariable -Name UploadPreview -Value YES
7881
} else {
7982
Set-BuildVariable -Name UploadPreview -Value NO
@@ -82,9 +85,7 @@ jobs:
8285
Set-BuildVariable -Name PreviewBuildInfoFile -Value $targetFile
8386
8487
## Create 'lts.json' if marked as a LTS release.
85-
if ($fileName -eq "stable.json") {
86-
[System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag
87-
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
88+
if ($isStable) {
8889
if ($ltsRelease) {
8990
$ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
9091
Copy-Item -Path $targetFile -Destination $ltsFile -Force
@@ -94,18 +95,24 @@ jobs:
9495
Set-BuildVariable -Name UploadLTS -Value NO
9596
}
9697
97-
## Only update the stable.json if the current version is greater than the stable version.
98-
if ($currentVersion -gt $stableVersion) {
99-
$versionFile = "$ENV:PIPELINE_WORKSPACE/$($currentVersion.Major)-$($currentVersion.Minor).json"
100-
Copy-Item -Path $targetFile -Destination $versionFile -Force
101-
Set-BuildVariable -Name StableBuildInfoFile -Value $versionFile
98+
## Gate stable.json upload on the metadata publish flag.
99+
if ($stableRelease) {
100+
Set-BuildVariable -Name StableBuildInfoFile -Value $targetFile
102101
Set-BuildVariable -Name UploadStable -Value YES
103102
} else {
104103
Set-BuildVariable -Name UploadStable -Value NO
105104
}
106105
106+
## Always publish the version-specific {Major}-{Minor}.json for non-preview builds.
107+
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
108+
$versionFile = "$ENV:PIPELINE_WORKSPACE/$($currentVersion.Major)-$($currentVersion.Minor).json"
109+
Copy-Item -Path $targetFile -Destination $versionFile -Force
110+
Set-BuildVariable -Name VersionSpecificBuildInfoFile -Value $versionFile
111+
Set-BuildVariable -Name UploadVersionSpecific -Value YES
112+
107113
} else {
108114
Set-BuildVariable -Name UploadStable -Value NO
115+
Set-BuildVariable -Name UploadVersionSpecific -Value NO
109116
}
110117
displayName: Create json files
111118
@@ -146,4 +153,12 @@ jobs:
146153
Write-Verbose -Verbose "Uploading $jsonFile to $containerName/$prefix/$blobName"
147154
Set-AzStorageBlobContent -File $jsonFile -Container $containerName -Blob "$prefix/$blobName" -Context $storageContext -Force
148155
}
149-
condition: and(succeeded(), or(eq(variables['UploadPreview'], 'YES'), eq(variables['UploadLTS'], 'YES'), eq(variables['UploadStable'], 'YES')))
156+
157+
#version-specific
158+
if ($env:UploadVersionSpecific -eq 'YES') {
159+
$jsonFile = "$env:VersionSpecificBuildInfoFile"
160+
$blobName = Get-Item $jsonFile | Split-Path -Leaf
161+
Write-Verbose -Verbose "Uploading $jsonFile to $containerName/$prefix/$blobName"
162+
Set-AzStorageBlobContent -File $jsonFile -Container $containerName -Blob "$prefix/$blobName" -Context $storageContext -Force
163+
}
164+
condition: and(succeeded(), or(eq(variables['UploadPreview'], 'YES'), eq(variables['UploadLTS'], 'YES'), eq(variables['UploadStable'], 'YES'), eq(variables['UploadVersionSpecific'], 'YES')))

‎tools/packaging/packaging.psm1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4314,7 +4314,7 @@ function New-MSIXPackage
43144314
Write-Verbose "Using Preview assets" -Verbose
43154315
} elseif ($LTS) {
43164316
# This is the PhoneProductId for the "Microsoft.PowerShell-LTS" package.
4317-
$PhoneProductId = "a9af273a-c636-47ac-bc2a-775edf80b2b9"
4317+
$PhoneProductId = "b7a4b003-3704-47a9-b018-cfcc9801f4fc"
43184318
Write-Verbose "Using LTS assets" -Verbose
43194319
}
43204320

0 commit comments

Comments
 (0)