Skip to content

Commit 331a2d2

Browse files
committed
infra: win python
1 parent 0304362 commit 331a2d2

File tree

1 file changed

+5
-44
lines changed

1 file changed

+5
-44
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -236,50 +236,11 @@ jobs:
236236
- name: Fetch depot_tools
237237
run: pnpm run fetch:depot_tools
238238

239-
- name: Locate Python (Windows)
240-
shell: pwsh
241-
run: |
242-
# Try to find python via direct command
243-
$pythonExe = $null
244-
$cmd = Get-Command python -ErrorAction SilentlyContinue
245-
if ($cmd) { $pythonExe = $cmd.Source }
246-
247-
# Fallback: use Windows Python launcher to discover installed versions
248-
if (-not $pythonExe) {
249-
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
250-
if ($pyLauncher) {
251-
try {
252-
$paths = & py -0p
253-
if ($paths) {
254-
$pythonExe = ($paths -split "`r?`n" | Where-Object { $_ -like "*python.exe" } | Select-Object -First 1)
255-
}
256-
} catch {
257-
Write-Host "py launcher exists but failed to enumerate versions" -ForegroundColor Yellow
258-
}
259-
}
260-
}
261-
262-
# Fallback: common hostedtoolcache locations on GitHub Windows runners
263-
if (-not $pythonExe) {
264-
$candidates = @(
265-
'C:\hostedtoolcache\windows\Python\3.12.6\x64\python.exe',
266-
'C:\hostedtoolcache\windows\Python\3.11.9\x64\python.exe',
267-
'C:\hostedtoolcache\windows\Python\3.10.11\x64\python.exe'
268-
)
269-
foreach ($p in $candidates) { if (Test-Path $p) { $pythonExe = $p; break } }
270-
}
271-
272-
if (-not $pythonExe) {
273-
Write-Error "Python not found. Please ensure it's available on the runner or install actions/setup-python."
274-
exit 1
275-
}
276-
277-
$pythonDir = Split-Path -Path $pythonExe -Parent
278-
echo $pythonDir >> $env:GITHUB_PATH
279-
echo "PYTHON=$pythonExe" >> $env:GITHUB_ENV
280-
281-
Write-Host "Using Python at: $pythonExe" -ForegroundColor Green
282-
python --version
239+
- name: Setup Python 3.9 (Windows)
240+
uses: actions/setup-python@v5
241+
with:
242+
python-version: '3.9'
243+
architecture: 'x64'
283244

284245
- name: Sync devtools-gn
285246
shell: pwsh

0 commit comments

Comments
 (0)