Skip to content

Commit b686c38

Browse files
committed
WinGet: add more details to manifests
1 parent 65a8c10 commit b686c38

File tree

2 files changed

+65
-21
lines changed

2 files changed

+65
-21
lines changed

.github/workflows/winget.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
contents: write
1616

1717
env:
18-
POWERSHELLYAMLVERSION: 0.4.1
18+
POWERSHELLYAMLVERSION: 0.4.12
1919
WINGETPKGS_ID: mlocati.GetText
2020
WINGETPKGS_REPO_UPSTREAM: microsoft/winget-pkgs
2121
WINGETPKGS_REPO_HEAD: master
@@ -70,14 +70,15 @@ jobs:
7070
$tagName = $tagName.Trim()
7171
}
7272
}
73-
$jsonData = & gh release view --repo=mlocati/gettext-iconv-windows $tagName --json tagName,isPrerelease,publishedAt,assets,url
73+
$jsonData = & gh release view --repo=${{ github.repository }} $tagName --json tagName,isDraft,isPrerelease,publishedAt,url,body,assets
7474
if (-not($?)) {
7575
throw "Failed to get release data for tag '$tagName': $($Error[0])"
7676
}
7777
$releaseData = $jsonData | ConvertFrom-Json
78-
if ($releaseData.isPrerelease) {
78+
if ($releaseData.isDraft) {
79+
Write-Host -Object "Release '$($releaseData.tagName)' is a draft, skipping."
80+
} elseif ($releaseData.isPrerelease) {
7981
Write-Host -Object "Release '$($releaseData.tagName)' is a pre-release, skipping."
80-
'submit=no' | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
8182
} else {
8283
$jsonData | Set-Content -LiteralPath tmp/release.json -Encoding utf8
8384
'submit=yes' | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
@@ -114,7 +115,11 @@ jobs:
114115
$releaseData = Get-Content -LiteralPath tmp/release.json | ConvertFrom-Json
115116
$manifestPath, $packageVersion = ./winget/create-manifest.ps1 ` -PackageIdentifier $env:WINGETPKGS_ID -ReleaseData $releaseData -ManifestsPath tmp/winget-pkgs/manifests
116117
Write-Host "Manifest created at: $manifestPath"
117-
Get-ChildItem -LiteralPath $manifestPath -Recurse -File | ForEach-Object { $_.FullName }
118+
Get-ChildItem -LiteralPath $manifestPath -Recurse -File | ForEach-Object {
119+
Write-Host "::group::$($_.FullName)"
120+
Get-Content -LiteralPath $_.FullName | Write-Host
121+
Write-Host '::endgroup::'
122+
}
118123
"manifest-path=$manifestPath" | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
119124
"package-version=$packageVersion" | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
120125
-
@@ -136,14 +141,13 @@ jobs:
136141
$status = git status --porcelain "manifests/$($env:WINGETPKGS_ID[0].ToString().ToLower())/$(($env:WINGETPKGS_ID -split '\.')[0])/"
137142
if (-not $status) {
138143
Write-Host 'No changes to commit.'
139-
'submit=no' | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
140144
} else {
141145
Write-Host 'Changes detected, will commit and push to fork.'
142-
'submit=yes' | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
146+
'commit=yes' | Add-Content -Path $env:GITHUB_OUTPUT -Encoding utf8
143147
}
144148
-
145149
name: Save deploy key
146-
if: steps.check-changes.outputs.submit == 'yes'
150+
if: steps.check-changes.outputs.commit == 'yes'
147151
run: |
148152
$sshDir = "$env:USERPROFILE\.ssh"
149153
$keyPath = "$sshDir\id_ed25519"
@@ -154,7 +158,7 @@ jobs:
154158
ssh-keygen -l -f $keyPath
155159
-
156160
name: Push changes to winget-pkgs fork
157-
if: steps.check-changes.outputs.submit == 'yes'
161+
if: steps.check-changes.outputs.commit == 'yes'
158162
working-directory: tmp/winget-pkgs
159163
run: |
160164
$env:GIT_SSH_COMMAND = 'ssh -o StrictHostKeyChecking=no'

winget/create-manifest.ps1

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ function New-InstallerEntry {
1919
[string] $Architecture,
2020
[Parameter(Mandatory = $true)]
2121
[ValidateLength(1, [int]::MaxValue)]
22-
[string] $AssetName
22+
[string] $AssetName,
23+
[Parameter(Mandatory = $true)]
24+
[ValidateLength(1, [int]::MaxValue)]
25+
[string] $DisplayName
2326
)
2427
$asset = $ReleaseData.assets | Where-Object -Property 'name' -Value $AssetName -EQ
2528
if (-not $asset) {
@@ -33,6 +36,12 @@ function New-InstallerEntry {
3336
Architecture = $Architecture
3437
InstallerUrl = $asset.url
3538
InstallerSha256 = $sha256
39+
AppsAndFeaturesEntries = @(
40+
[ordered]@{
41+
DisplayName = $DisplayName
42+
ProductCode = 'gettext-iconv_is1'
43+
}
44+
)
3645
}
3746
}
3847

@@ -78,7 +87,37 @@ $defaultLocale = [ordered]@{
7887
LicenseUrl = "https://github.com/mlocati/gettext-iconv-windows/blob/$($ReleaseData.tagName)/LICENSE.txt"
7988
Copyright = 'Copyright (c) Michele Locati'
8089
CopyrightUrl = "https://github.com/mlocati/gettext-iconv-windows/blob/$($ReleaseData.tagName)/LICENSE.txt"
81-
ShortDescription = 'gettext and iconv tools'
90+
ShortDescription = 'GNU gettext and GNU iconv tools'
91+
Description = @'
92+
This package provides the GNU gettext and GNU iconv tools for Windows, which are used for internationalization and localization of software applications.
93+
94+
The GNU gettext tools include the following command-line utilities used for managing translation files and generating localized resources:
95+
96+
- gettext: display native language translation of a textual message
97+
- msgattrib: filters the messages of a translation catalog according to their attributes, and manipulates the attributes
98+
- msgcat: concatenates and merges the specified PO files
99+
- msgcmp: compare two Uniforum style .po files to check that both contain the same set of msgid strings
100+
- msgcomm: find messages which are common to two or more of the specified PO files
101+
- msgconv: convert a translation catalog to a different character encoding
102+
- msgen: create an English translation catalog
103+
- msgexec: apply a command to all translations of a translation catalog
104+
- msgfilter: apply a filter to all translations of a translation catalog
105+
- msgfmt: generate binary message catalog from textual translation description.
106+
- msggrep: extract all messages of a translation catalog that match a given pattern or belong to some given source files
107+
- msginit: create a new PO file, initializing the meta information with values from the user's environment
108+
- msgmerge: merge two Uniforum style .po files together
109+
- msgpre: pretranslate a translation catalog
110+
- msgunfmt: convert a binary message catalog to Uniforum style .po file
111+
- msguniq: unify duplicate translations in a translation catalog
112+
- ngettext: display native language translation of a textual message whose grammatical form depends on a number
113+
- recode-sr-latin: recode Serbian text from Cyrillic to Latin script
114+
- spit: pass standard input to a Large Language Model (LLM) instance and prints the response
115+
- xgettext: extract translatable strings from given input files
116+
117+
The GNU iconv tool is used for converting text between different character encodings.
118+
119+
The package comes with Unicode CLDR data, which is used by msginit to create translation catalogs with the plural rules defined in CLDR (this requires setting the GETTEXTCLDRDIR environment variable to the path of the CLDR data).
120+
'@
82121
Moniker = 'gettext'
83122
Tags = @(
84123
'GNU'
@@ -118,6 +157,7 @@ $defaultLocale = [ordered]@{
118157
AgreementUrl = 'https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html'
119158
}
120159
)
160+
ReleaseNotes = (($ReleaseData.body.Trim() -replace '\r\n',"`n") -replace '\r',"`n") -replace '\n',[environment]::NewLine
121161
ReleaseNotesUrl = $ReleaseData.url
122162
ManifestType = 'defaultLocale'
123163
ManifestVersion = $manifestVersion
@@ -131,21 +171,21 @@ $installer = [ordered]@{
131171
MinimumOSVersion = '6.1.7601' # Windows 7
132172
InstallerType = 'inno'
133173
Scope = 'machine'
174+
InstallModes = @(
175+
'interactive'
176+
'silent'
177+
'silentWithProgress'
178+
)
134179
UpgradeBehavior = 'install'
135180
ProductCode = 'gettext-iconv_is1'
136181
ReleaseDate = ([datetime]$ReleaseData.publishedAt).ToUniversalTime().ToString('yyyy\-MM\-dd')
137-
AppsAndFeaturesEntries = @(
138-
[ordered]@{
139-
ProductCode = 'gettext-iconv_is1'
140-
}
141-
)
142182
ElevationRequirement = 'elevatesSelf'
143183
InstallationMetadata = [ordered]@{
144184
DefaultInstallLocation = '%ProgramFiles%\gettext-iconv'
145185
}
146186
Installers = @(
147-
New-InstallerEntry -Architecture x86 -AssetName "gettext$gettextVersion-iconv$iconvVersion-shared-32.exe"
148-
New-InstallerEntry -Architecture x64 -AssetName "gettext$gettextVersion-iconv$iconvVersion-shared-64.exe"
187+
New-InstallerEntry -Architecture x86 -AssetName "gettext$gettextVersion-iconv$iconvVersion-shared-32.exe" -DisplayName "gettext $gettextVersion + iconv $iconvVersion - shared (32 bit)"
188+
New-InstallerEntry -Architecture x64 -AssetName "gettext$gettextVersion-iconv$iconvVersion-shared-64.exe" -DisplayName "gettext $gettextVersion + iconv $iconvVersion - shared (64 bit)"
149189
)
150190
ManifestType = 'installer'
151191
ManifestVersion = $manifestVersion
@@ -161,11 +201,11 @@ if (Test-Path -LiteralPath $manifestPath -PathType Container) {
161201
}
162202
New-Item -Path $manifestPath -ItemType Directory -Force | Out-Null
163203

164-
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $version) |
204+
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $version ) |
165205
Out-File -FilePath (Join-Path -Path $manifestPath -ChildPath "$PackageIdentifier.yaml") -Encoding UTF8 -NoNewline
166-
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $defaultLocale) |
206+
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $defaultLocale ) |
167207
Out-File -FilePath (Join-Path -Path $manifestPath -ChildPath "$PackageIdentifier.locale.$($version['DefaultLocale']).yaml") -Encoding UTF8 -NoNewline
168-
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $installer) |
208+
@("# yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.$manifestVersion.schema.json$([environment]::NewLine)") + (ConvertTo-Yaml $installer ) |
169209
Out-File -FilePath (Join-Path -Path $manifestPath -ChildPath "$PackageIdentifier.installer.yaml") -Encoding UTF8 -NoNewline
170210

171211
$manifestPath, $packageVersion

0 commit comments

Comments
 (0)