|
1 | 1 | # .github/workflows/windows-build.yml |
2 | 2 | # GitHub Actions workflow to build a standalone Windows executable and create a release. |
3 | | -# This version correctly downloads the 'install_only' Python package and bootstraps pip into it. |
| 3 | +# This version correctly downloads the full standalone Python package and extracts the |
| 4 | +# runnable distribution from the correct 'install' subfolder. |
4 | 5 |
|
5 | 6 | name: Build and Release Windows App |
6 | 7 |
|
@@ -30,47 +31,35 @@ jobs: |
30 | 31 | - name: Prepare Portable Python Runtime |
31 | 32 | shell: pwsh |
32 | 33 | run: | |
33 | | - # 1. Download the correct 'install_only' standalone Python distribution in .tar.gz format. |
| 34 | + # 1. Download the full, pre-built, standalone Python distribution. |
34 | 35 | $pythonVersion = "3.11.13" |
35 | 36 | $releaseTag = "20250808" |
36 | | - $fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-install_only.tar.gz" |
| 37 | + $fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-pgo-full.tar.zst" |
37 | 38 | $url = "https://github.com/astral-sh/python-build-standalone/releases/download/$releaseTag/$fileName" |
38 | 39 | |
39 | 40 | Write-Host "Downloading Python runtime from $url" |
40 | | - Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.gz" |
| 41 | + Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst" |
41 | 42 |
|
42 | | - # 2. Decompress the archive. tar on Windows runners handles .gz natively. |
| 43 | + # 2. Decompress the archive. |
43 | 44 | Write-Host "Decompressing Python runtime..." |
44 | | - tar -xzf python-standalone.tar.gz |
| 45 | + tar -I zstd -xf python-standalone.tar.zst |
45 | 46 | |
46 | | - # 3. Move the contents to the 'python_runtime' directory |
47 | | - Move-Item -Path "python\*" -Destination "python_runtime" |
| 47 | + # 3. BUG FIX: Move the contents from the correct 'python\install' subfolder. |
| 48 | + Write-Host "Moving extracted runtime to 'python_runtime'..." |
| 49 | + Move-Item -Path "python\install\*" -Destination "python_runtime" |
48 | 50 | Remove-Item "python" -Recurse |
49 | 51 | |
50 | | - # --- Verification Step 1 --- |
51 | | - Write-Host "Verifying python.exe exists..." |
| 52 | + # --- Verification Step --- |
| 53 | + Write-Host "Verifying contents of python_runtime directory:" |
| 54 | + Get-ChildItem -Path "python_runtime" |
52 | 55 | if (-not (Test-Path "python_runtime\python.exe")) { |
53 | 56 | Write-Host "CRITICAL ERROR: python.exe not found after extraction. Build cannot continue." |
54 | 57 | exit 1 |
55 | 58 | } |
56 | | - |
57 | | - # 4. Download the official pip bootstrap script. |
58 | | - Write-Host "Downloading get-pip.py..." |
59 | | - Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile "python_runtime\get-pip.py" |
60 | | - |
61 | | - # 5. Run the bootstrap script to install pip into the portable runtime. |
62 | | - Write-Host "Installing pip into the portable runtime..." |
63 | | - .\python_runtime\python.exe .\python_runtime\get-pip.py |
64 | | - |
65 | | - # --- Verification Step 2 --- |
66 | | - Write-Host "Verifying pip.exe exists..." |
67 | 59 | if (-not (Test-Path "python_runtime\Scripts\pip.exe")) { |
68 | | - Write-Host "CRITICAL ERROR: pip.exe not found after installation. Build cannot continue." |
| 60 | + Write-Host "CRITICAL ERROR: pip.exe not found after extraction. Build cannot continue." |
69 | 61 | exit 1 |
70 | 62 | } |
71 | | -
|
72 | | - # 6. Clean up the bootstrap script. |
73 | | - Remove-Item "python_runtime\get-pip.py" |
74 | 63 | Write-Host "Python runtime prepared successfully." |
75 | 64 |
|
76 | 65 | - name: Cache Pip and Nuitka |
|
0 commit comments