@@ -142,9 +142,9 @@ jobs:
142142
143143 New-Item -ItemType Directory -Force -Path choco/tools
144144
145- @"
145+ $nuspec = @"
146146 <?xml version="1.0" encoding="utf-8"?>
147- <package xmlns="http://schemas.chocolatey.org /packaging/2015/06 /nuspec.xsd">
147+ <package xmlns="http://schemas.microsoft.com /packaging/2010/07 /nuspec.xsd">
148148 <metadata>
149149 <id>omp-manager</id>
150150 <version>$version</version>
@@ -154,13 +154,17 @@ jobs:
154154 <projectUrl>https://github.com/marlocarlo/omp-manager</projectUrl>
155155 <licenseUrl>https://github.com/marlocarlo/omp-manager/blob/master/LICENSE</licenseUrl>
156156 <requireLicenseAcceptance>false</requireLicenseAcceptance>
157- <description>A TUI manager for Oh My Posh - browse themes, install fonts, and configure shells with zero effort.</description>
158- <tags>oh-my-posh prompt theme tui terminal</tags>
157+ <description>A TUI manager for Oh My Posh — browse themes, install fonts, and configure shells with zero effort.</description>
158+ <summary>TUI manager for Oh My Posh prompt theming</summary>
159+ <tags>oh-my-posh prompt theme tui terminal cli</tags>
160+ <packageSourceUrl>https://github.com/marlocarlo/omp-manager</packageSourceUrl>
161+ <bugTrackerUrl>https://github.com/marlocarlo/omp-manager/issues</bugTrackerUrl>
159162 </metadata>
160163 </package>
161- "@ | Out-File -Encoding utf8 choco/omp-manager.nuspec
164+ "@
165+ [System.IO.File]::WriteAllText("$PWD/choco/omp-manager.nuspec", $nuspec.Trim())
162166
163- @"
167+ $install = @"
164168 `$ErrorActionPreference = 'Stop'
165169 `$toolsDir = Split-Path -Parent `$MyInvocation.MyCommand.Definition
166170 `$url = '$url'
@@ -171,7 +175,8 @@ jobs:
171175 -UnzipLocation `$toolsDir ``
172176 -Checksum64 `$checksum ``
173177 -ChecksumType64 'sha256'
174- "@ | Out-File -Encoding utf8 choco/tools/chocolateyinstall.ps1
178+ "@
179+ [System.IO.File]::WriteAllText("$PWD/choco/tools/chocolateyinstall.ps1", $install.Trim())
175180
176181 choco pack choco/omp-manager.nuspec --output-directory choco
177182
@@ -210,11 +215,90 @@ jobs:
210215 - name : Install wingetcreate
211216 shell : pwsh
212217 run : |
218+ $ProgressPreference = 'SilentlyContinue'
213219 Invoke-WebRequest -Uri "https://aka.ms/wingetcreate/latest" -OutFile wingetcreate.exe
214220
215221 - name : Submit to winget-pkgs
216222 shell : pwsh
217223 run : |
218224 $version = "${{ steps.version.outputs.VERSION }}"
225+ $sha256 = "${{ steps.checksum.outputs.SHA256 }}"
219226 $url = "https://github.com/marlocarlo/omp-manager/releases/download/${{ github.ref_name }}/omp-manager-x86_64-pc-windows-msvc.zip"
220- ./wingetcreate.exe update marlocarlo.omp-manager --version $version --urls $url --token ${{ secrets.WINGET_GH_PAT }} --submit
227+
228+ # Try update first (works when the package already exists in winget-pkgs)
229+ ./wingetcreate.exe update marlocarlo.OmpManager `
230+ --version $version --urls $url `
231+ --token ${{ secrets.WINGET_GH_PAT }} --submit 2>&1 | Tee-Object -Variable updateOutput
232+
233+ if ($LASTEXITCODE -ne 0) {
234+ Write-Host "Package not yet in winget-pkgs — creating initial manifest..."
235+
236+ $manifestDir = "manifests/m/marlocarlo/OmpManager/$version"
237+ New-Item -ItemType Directory -Force -Path $manifestDir
238+
239+ # Version manifest
240+ @"
241+ # Created using GitHub Actions automated release pipeline
242+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json
243+ PackageIdentifier: marlocarlo.OmpManager
244+ PackageVersion: $version
245+ DefaultLocale: en-US
246+ ManifestType: version
247+ ManifestVersion: 1.6.0
248+ "@ | ForEach-Object { $_.Trim() } | Set-Content -Path "$manifestDir/marlocarlo.OmpManager.yaml" -Encoding utf8NoBOM
249+
250+ # Installer manifest
251+ @"
252+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json
253+ PackageIdentifier: marlocarlo.OmpManager
254+ PackageVersion: $version
255+ InstallerType: zip
256+ NestedInstallerType: portable
257+ NestedInstallerFiles:
258+ - RelativeFilePath: omp-manager.exe
259+ PortableCommandAlias: omp-manager
260+ Installers:
261+ - Architecture: x64
262+ InstallerUrl: $url
263+ InstallerSha256: $sha256
264+ ManifestType: installer
265+ ManifestVersion: 1.6.0
266+ "@ | ForEach-Object { $_.Trim() } | Set-Content -Path "$manifestDir/marlocarlo.OmpManager.installer.yaml" -Encoding utf8NoBOM
267+
268+ # Locale manifest
269+ @"
270+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json
271+ PackageIdentifier: marlocarlo.OmpManager
272+ PackageVersion: $version
273+ PackageLocale: en-US
274+ Publisher: marlocarlo
275+ PublisherUrl: https://github.com/marlocarlo
276+ PackageName: OMP Manager
277+ PackageUrl: https://github.com/marlocarlo/omp-manager
278+ License: MIT
279+ LicenseUrl: https://github.com/marlocarlo/omp-manager/blob/master/LICENSE
280+ ShortDescription: A TUI manager for Oh My Posh — browse themes, install fonts, and configure shells
281+ Description: A terminal user interface to browse themes, install Nerd Fonts, and configure shell profiles for Oh My Posh with zero effort.
282+ Tags:
283+ - cli
284+ - oh-my-posh
285+ - prompt
286+ - terminal
287+ - tui
288+ ManifestType: defaultLocale
289+ ManifestVersion: 1.6.0
290+ "@ | ForEach-Object { $_.Trim() } | Set-Content -Path "$manifestDir/marlocarlo.OmpManager.locale.en-US.yaml" -Encoding utf8NoBOM
291+
292+ Write-Host "Generated manifests in $manifestDir"
293+ Get-ChildItem -Recurse $manifestDir | ForEach-Object { Write-Host $_.FullName }
294+
295+ # Validate and submit
296+ ./wingetcreate.exe submit $manifestDir `
297+ --prtitle "New package: marlocarlo.OmpManager version $version" `
298+ --token ${{ secrets.WINGET_GH_PAT }}
299+
300+ if ($LASTEXITCODE -ne 0) {
301+ Write-Error "wingetcreate submit failed"
302+ exit 1
303+ }
304+ }
0 commit comments