Skip to content

Commit f57c213

Browse files
committed
Use the installed version of Python
1 parent 76ee550 commit f57c213

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,29 @@ jobs:
138138
python3.8 -m pip install --upgrade pip
139139
python3.8 -m pip install cryptography
140140
141+
- name: Find the latest version of Python (Windows)
142+
if: runner.os == 'Windows'
143+
run: |
144+
$pythonVersions = Get-ChildItem -Path "C:/hostedtoolcache/windows/Python/" -Directory | Where-Object { $_.Name -match '\d+\.\d+\.\d+' } | Sort-Object { [Version]($_.Name) } -Descending
145+
if ($pythonVersions.Count -gt 0) {
146+
$latestPythonVersion = $pythonVersions[0].Name
147+
$pythonPath = "C:/hostedtoolcache/windows/Python/$latestPythonVersion/x64"
148+
Write-Output "Latest Python version found: $latestPythonVersion"
149+
Write-Output "Python directory path: $pythonPath"
150+
$env:Path = "$pythonPath;" + $env:Path
151+
Write-Output "Updated PATH environment variable:"
152+
Write-Output $env:Path
153+
} else {
154+
Write-Error "No Python versions found in C:/hostedtoolcache/windows/Python/"
155+
exit 1
156+
}
157+
141158
- name: Install python3 cryptography module (Windows)
142159
if: runner.os == 'Windows'
143160
run: |
144-
C:/hostedtoolcache/windows/Python/3.12.3/x64/python3.exe -m ensurepip
145-
C:/hostedtoolcache/windows/Python/3.12.3/x64/python.exe -m pip install --upgrade pip
146-
C:/hostedtoolcache/windows/Python/3.12.3/x64/python.exe -m pip install cryptography
161+
python.exe -m ensurepip
162+
python.exe -m pip install --upgrade pip
163+
python.exe -m pip install cryptography
147164
148165
- name: Configure CMake
149166
run: cmake

0 commit comments

Comments
 (0)