Skip to content

Commit 786f787

Browse files
committed
Update Windows CI workflow to dynamically download the latest Python 3.12 embeddable version
1 parent 7a6c352 commit 786f787

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/windows.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ jobs:
104104
$stage = 'C:\_stage\ssh-studio'
105105
New-Item -ItemType Directory -Force -Path $stage | Out-Null
106106
107-
# Download Python embeddable 3.12
108-
$pyUrl = 'https://www.python.org/ftp/python/3.12.11/python-3.12.11-embed-amd64.zip'
107+
# Download latest Python 3.12 embeddable (resolve dynamically)
109108
$pyZip = "$env:RUNNER_TEMP\python-embed.zip"
109+
$idx = Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/' -UseBasicParsing
110+
$vers = ($idx.Links | Where-Object { $_.href -match '^3\.12\.(\d+)/$' } | ForEach-Object { $_.href.TrimEnd('/') }) | Sort-Object {[version]$_} -Descending
111+
if (-not $vers -or -not $vers[0]) { throw 'Could not determine latest Python 3.12 version from python.org index.' }
112+
$pyVer = $vers[0]
113+
$pyUrl = "https://www.python.org/ftp/python/$pyVer/python-$pyVer-embed-amd64.zip"
110114
Invoke-WebRequest -Uri $pyUrl -OutFile $pyZip
111115
Expand-Archive -LiteralPath $pyZip -DestinationPath "$stage\python" -Force
112116
$pth = Join-Path "$stage\python" 'python312._pth'

0 commit comments

Comments
 (0)