|
9 | 9 |
|
10 | 10 | steps: |
11 | 11 | - name: Checkout code |
12 | | - uses: actions/checkout@v4 |
| 12 | + uses: actions/checkout@v3 |
13 | 13 |
|
14 | 14 | - name: Install Python (if not already installed) |
15 | 15 | shell: powershell |
16 | 16 | run: | |
| 17 | + # Check if Python is already installed |
17 | 18 | if (-not (Get-Command python -ErrorAction SilentlyContinue)) { |
18 | 19 | Write-Host "Python not found, installing..." |
19 | | - # Install Python (adjust the path and version as necessary) |
| 20 | + # Download and Install Python |
20 | 21 | $pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0.exe" |
21 | 22 | $installerPath = "$env:temp\python-installer.exe" |
22 | 23 | Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $installerPath |
| 24 | + # Install Python and make sure it's added to the PATH |
23 | 25 | Start-Process -FilePath $installerPath -ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1" -Wait |
24 | 26 | Write-Host "Python installed" |
25 | 27 | } else { |
26 | 28 | Write-Host "Python already installed" |
27 | 29 | } |
28 | 30 |
|
29 | | - - name: Install pip |
| 31 | + # Verify if Python is installed and accessible |
| 32 | + $pythonPath = Get-Command python -ErrorAction SilentlyContinue |
| 33 | + if ($pythonPath) { |
| 34 | + Write-Host "Python found at $pythonPath" |
| 35 | + } else { |
| 36 | + Write-Host "Python installation failed. Exiting." |
| 37 | + exit 1 |
| 38 | + } |
| 39 | +
|
| 40 | + - name: Install pip (if not already installed) |
30 | 41 | shell: powershell |
31 | 42 | run: | |
| 43 | + # Check if pip is already installed |
32 | 44 | if (-not (Get-Command pip -ErrorAction SilentlyContinue)) { |
33 | 45 | Write-Host "pip not found, installing..." |
| 46 | + # Install pip using Python |
34 | 47 | python -m ensurepip --upgrade |
35 | 48 | python -m pip install --upgrade pip |
36 | 49 | Write-Host "pip installed" |
|
0 commit comments