Simplify Microsoft Store listing metadata by jshigetomi · Pull Request #27968 · PowerShell/PowerShell · GitHub
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
Empty file.
27 changes: 3 additions & 24 deletions .pipelines/store/PDPs/PDP/en-US/PDP.xml
2 changes: 0 additions & 2 deletions .pipelines/store/SBConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"qps-ploca",
"qps-plocm"
],
"MediaRootPath": "",
"MediaFallbackLanguage": "en-US",
"PackagePath": [],
"OutPath": "",
"OutName": "",
Expand Down
39 changes: 5 additions & 34 deletions .pipelines/templates/package-store-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ jobs:
# Define app configurations for each channel
$channelConfigs = @{
'LTS' = @{
AppStoreName = 'PowerShell-LTS'
ProductId = '$(productId-LTS)'
AppId = '$(AppID-LTS)'
ServiceEndpoint = "StoreAppPublish-Stable"
}
'Stable' = @{
AppStoreName = 'PowerShell'
ProductId = '$(productId-Stable)'
AppId = '$(AppID-Stable)'
ServiceEndpoint = "StoreAppPublish-Stable"
}
'Preview' = @{
AppStoreName = 'PowerShell (Preview)'
ProductId = '$(productId-Preview)'
AppId = '$(AppID-Preview)'
ServiceEndpoint = "StoreAppPublish-Preview"
Expand Down Expand Up @@ -100,36 +97,8 @@ jobs:

$config = $channelConfigs[$currentChannel]
Write-Verbose -Verbose "Selected channel: $currentChannel"
Write-Verbose -Verbose "App Store Name: $($config.AppStoreName)"
Write-Verbose -Verbose "Product ID: $($config.ProductId)"

# Update PDP.xml file
$pdpPath = '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP/en-US/PDP.xml'
if (Test-Path $pdpPath) {
Write-Verbose -Verbose "Updating PDP file: $pdpPath"

[xml]$pdpXml = Get-Content $pdpPath -Raw

# Create namespace manager for XML with default namespace
$nsManager = New-Object System.Xml.XmlNamespaceManager($pdpXml.NameTable)
$nsManager.AddNamespace("pd", "http://schemas.microsoft.com/appx/2012/ProductDescription")

$appStoreNameElement = $pdpXml.SelectSingleNode("//pd:AppStoreName", $nsManager)
if ($appStoreNameElement) {
$appStoreNameElement.SetAttribute("_locID", $config.AppStoreName)
Write-Verbose -Verbose "Updated AppStoreName _locID to: $($config.AppStoreName)"
} else {
Write-Warning "AppStoreName element not found in PDP file"
}

$pdpXml.Save($pdpPath)
Write-Verbose -Verbose "PDP file updated successfully"
Get-Content -Path $pdpPath | Write-Verbose -Verbose
} else {
Write-Error "PDP file not found: $pdpPath"
exit 1
}

# Update SBConfig.json file
$sbConfigPath = '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/SBConfig.json'
if (Test-Path $sbConfigPath) {
Expand Down Expand Up @@ -190,7 +159,7 @@ jobs:

Write-Verbose -Verbose "Variables set successfully"
name: UpdateConfigs
displayName: Update PDPs and SBConfig.json
displayName: Update SBConfig.json and Store Variables

- pwsh: |
Write-Verbose -Verbose "Checking variables after UpdateConfigs:"
Expand All @@ -209,7 +178,8 @@ jobs:
contents: '*.msixBundle'
outSBName: 'PowerShellStorePackage'
pdpPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP'
pdpMediaPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP-Media'
# StoreBroker v3 requires a media root with a PDP root, even when the PDP has no media.
pdpMediaPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP'

- task: MS-RDX-MRO.windows-store-publish.package-task.store-package@3
displayName: 'Create StoreBroker Package (Stable/LTS)'
Expand All @@ -221,7 +191,8 @@ jobs:
contents: '*.msixBundle'
outSBName: 'PowerShellStorePackage'
pdpPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP'
pdpMediaPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP-Media'
# StoreBroker v3 requires a media root with a PDP root, even when the PDP has no media.
pdpMediaPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDPs/PDP'

- pwsh: |
$outputDirectory = "$(ob_outputDirectory)"
Expand Down
39 changes: 29 additions & 10 deletions .pipelines/templates/release-MSIX-Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,42 @@ jobs:
}
$endURL = $tagString -replace '^v','' -replace '\.',''
$message = "Changelog: https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL"
$changelogLink = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL"
Write-Verbose -Verbose "Release Notes for the Store:"
Write-Verbose -Verbose "$message"
$jsonPath = "$(Pipeline.Workspace)\SBOutDir\PowerShellStorePackage.json"
$json = Get-Content $jsonPath -Raw | ConvertFrom-Json
$json.listings.'en-us'.baseListing.releaseNotes = $message
$releaseNoteVariables = @{
'___VERSION___' = $tagString
'___CHANGELOGLINK___' = $changelogLink
}
$listingProperties = @($json.listings.PSObject.Properties)
if ($listingProperties.Count -eq 0) {
throw "Store listings are missing from '$jsonPath'."
}
# Add PowerShell version to the top of the description
$description = $json.listings.'en-us'.baseListing.description
$version = "$(ReleaseTag)"
$updatedDescription = "Version: $version`n`n$description"
$json.listings.'en-us'.baseListing.description = $updatedDescription
Write-Verbose -Verbose "Updated description: $updatedDescription"
foreach ($listingProperty in $listingProperties) {
$language = $listingProperty.Name
$releaseNotes = $listingProperty.Value.baseListing.releaseNotes
if ([string]::IsNullOrWhiteSpace($releaseNotes)) {
throw "Store release notes for '$language' are missing from '$jsonPath'."
}
foreach ($placeholder in $releaseNoteVariables.Keys) {
if (-not $releaseNotes.Contains($placeholder)) {
throw "Store release notes for '$language' do not contain the required placeholder '$placeholder'."
}
$releaseNotes = $releaseNotes.Replace($placeholder, $releaseNoteVariables[$placeholder])
}
$listingProperty.Value.baseListing.releaseNotes = $releaseNotes
Write-Verbose -Verbose "Release notes for '$language':"
Write-Verbose -Verbose $releaseNotes
}
$json | ConvertTo-Json -Depth 100 | Set-Content $jsonPath -Encoding UTF8
displayName: 'Add Changelog Link and Version Number to SBJSON'
displayName: 'Set Store Release Note Variables'

- task: PowerShell@2
condition: or(eq(variables['LTS'], 'true'), eq(variables['STABLE'], 'true'), eq(variables['PREVIEW'], 'true'))
Expand Down
13 changes: 13 additions & 0 deletions assets/AppxManifest.xml
Loading