mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-04-21 17:47:22 +00:00
fix(ci): use github API for choco release (#15897)
### What does this PR do? Fixes the Chocolatey package update script that was failing with: ``` au_GetLatest failed Object reference not set to an instance of an object. ``` The script was scraping the GitHub page, which recently broke. This switches to the GitHub API. ### Screenshot / video of UI N/A ### What issues does this PR fix or reference? Closes https://github.com/podman-desktop/podman-desktop/issues/15896 ### How to test this PR? ```powershell # Install au if not already choco install au -y # Run script cd .chocolatey/podman-desktop $env:VERSION = "1.25.0" ./update.ps1 # Expect nuspec & releaseNotes to be updated ``` Signed-off-by: Charlie Drage <charlie@charliedrage.com>
This commit is contained in:
parent
294d6207ab
commit
60140cbf26
1 changed files with 12 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import-module au
|
||||
|
||||
$version = $env:VERSION
|
||||
$releases = 'https://github.com/containers/podman-desktop/releases/expanded_assets/v' + $version
|
||||
$apiUrl = 'https://api.github.com/repos/containers/podman-desktop/releases/tags/' + 'v' + $version
|
||||
|
||||
function global:au_SearchReplace {
|
||||
@{
|
||||
|
|
@ -17,15 +17,21 @@ function global:au_SearchReplace {
|
|||
}
|
||||
|
||||
function global:au_GetLatest {
|
||||
$download_page = Invoke-WebRequest -Uri $releases
|
||||
$release = Invoke-RestMethod -Uri $apiUrl -Headers @{ 'User-Agent' = 'PowerShell' }
|
||||
|
||||
$url64 = $download_page.links | ? href -match '-setup.exe$' | % href | select -First 1
|
||||
$version = (Split-Path ( Split-Path $url64 ) -Leaf).Substring(1)
|
||||
$asset = $release.assets | Where-Object { $_.name -match '-setup\.exe$' } | Select-Object -First 1
|
||||
|
||||
if (-not $asset) {
|
||||
throw "no -setup.exe asset found for $version"
|
||||
}
|
||||
|
||||
$url64 = $asset.browser_download_url
|
||||
$releaseNotes = $release.html_url
|
||||
|
||||
@{
|
||||
URL64 = 'https://github.com' + $url64
|
||||
URL64 = $url64
|
||||
Version = $version
|
||||
ReleaseNotes = $releases
|
||||
ReleaseNotes = $releaseNotes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue