diff --git a/.gitea/workflows/build-windows-release.yml b/.gitea/workflows/build-windows-release.yml index 02544f0..8bf225b 100644 --- a/.gitea/workflows/build-windows-release.yml +++ b/.gitea/workflows/build-windows-release.yml @@ -67,9 +67,23 @@ jobs: $pythonArgs = @('-3') } else { $python = Get-Command python -ErrorAction SilentlyContinue - if (-not $python) { throw 'Python is required to install Qt with aqtinstall, but py/python was not found on PATH.' } - $pythonExe = $python.Source - $pythonArgs = @() + if ($python) { + $pythonExe = $python.Source + $pythonArgs = @() + } else { + $pythonRoot = Join-Path $env:RUNNER_TEMP 'python312' + $pythonExe = Join-Path $pythonRoot 'python.exe' + if (-not (Test-Path $pythonExe)) { + $installer = Join-Path $env:RUNNER_TEMP 'python-installer.exe' + $pythonUrl = 'https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe' + Write-Host "Downloading Python from $pythonUrl" + Invoke-WebRequest -Uri $pythonUrl -OutFile $installer + & $installer /quiet InstallAllUsers=0 TargetDir=$pythonRoot Include_pip=1 Include_test=0 PrependPath=0 + if ($LASTEXITCODE -ne 0) { throw "Python installer failed, exit code: $LASTEXITCODE" } + } + if (-not (Test-Path $pythonExe)) { throw "Python installation finished but python.exe was not found: $pythonExe" } + $pythonArgs = @() + } } & $pythonExe @pythonArgs -m pip install --user --upgrade aqtinstall