Skip to content

Commit 61b8261

Browse files
committed
Enhance Windows CI workflow to robustly download GTK runtime with improved matching and fallback options
1 parent ec96d9f commit 61b8261

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/windows.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ jobs:
104104
$stage = 'C:\_stage\ssh-studio'
105105
New-Item -ItemType Directory -Force -Path $stage | Out-Null
106106
107-
# Download specific Python 3.13.7 embeddable ZIP (validated)
108107
$pyZip = "$env:RUNNER_TEMP\python-embed.zip"
109108
$pyUrl = 'https://www.python.org/ftp/python/3.13.7/python-3.13.7-embed-amd64.zip'
110109
Invoke-WebRequest -Uri $pyUrl -OutFile $pyZip
@@ -117,14 +116,27 @@ jobs:
117116
if ($content -notmatch 'import site') { Add-Content -Path $pth -Value "`r`nimport site`r`n" }
118117
}
119118
120-
# Download GTK runtime (gvsbuild release)
121119
$api = 'https://api.github.com/repos/wingtk/gvsbuild/releases/latest'
122120
$headers = @{ 'User-Agent' = 'github-actions'; 'Authorization' = "Bearer $env:GITHUB_TOKEN" }
123121
$rel = Invoke-RestMethod -Headers $headers -Uri $api -Method GET
124-
$asset = $rel.assets | Where-Object { $_.name -match 'gtk.*runtime.*(64|x86_64).*\.zip' } | Select-Object -First 1
125-
if (-not $asset) { throw 'Could not find GTK runtime asset in gvsbuild latest release.' }
122+
$asset = $rel.assets |
123+
Where-Object { $_.name -match '(?i)gtk(4)?[-_]?.*(runtime|bundle).*(64|x86_64).*\.zip$' -or $_.name -match '(?i)^gtk4-runtime-64.*\.zip$' -or $_.name -match '(?i)^gtk-runtime-64.*\.zip$' } |
124+
Select-Object -First 1
126125
$gtkZip = "$env:RUNNER_TEMP\gtk-runtime.zip"
127-
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $gtkZip
126+
if ($asset) {
127+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $gtkZip
128+
} else {
129+
# Fallback to well-known asset names under latest/download
130+
$fallbacks = @(
131+
'https://github.com/wingtk/gvsbuild/releases/latest/download/gtk4-runtime-64.zip',
132+
'https://github.com/wingtk/gvsbuild/releases/latest/download/gtk-runtime-64.zip'
133+
)
134+
$ok = $false
135+
foreach ($u in $fallbacks) {
136+
try { Invoke-WebRequest -Uri $u -OutFile $gtkZip -ErrorAction Stop; $ok = $true; break } catch { }
137+
}
138+
if (-not $ok) { throw 'Could not download GTK runtime from gvsbuild latest release.' }
139+
}
128140
Expand-Archive -LiteralPath $gtkZip -DestinationPath "$stage\gtk_tmp" -Force
129141
$gtkOut = "$stage\gtk"
130142
New-Item -ItemType Directory -Force -Path $gtkOut | Out-Null

0 commit comments

Comments
 (0)