|
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 full standalone Python package and extracts the |
4 | | -# runnable distribution from the correct 'install' subfolder. |
| 3 | +# This version correctly downloads and prepares a full, portable Python runtime. |
5 | 4 |
|
6 | 5 | name: Build and Release Windows App |
7 | 6 |
|
|
28 | 27 | with: |
29 | 28 | python-version: '3.11' |
30 | 29 |
|
31 | | - - name: Prepare Portable Python Runtime |
32 | | - shell: pwsh |
33 | | - run: | |
34 | | - # 1. Download the full, pre-built, standalone Python distribution. |
35 | | - $pythonVersion = "3.11.13" |
36 | | - $releaseTag = "20250808" |
37 | | - $fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-pgo-full.tar.zst" |
38 | | - $url = "https://github.com/astral-sh/python-build-standalone/releases/download/$releaseTag/$fileName" |
39 | | - |
40 | | - Write-Host "Downloading Python runtime from $url" |
41 | | - Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst" |
42 | | -
|
43 | | - # 2. Decompress the archive. |
44 | | - Write-Host "Decompressing Python runtime..." |
45 | | - tar -I zstd -xf python-standalone.tar.zst |
46 | | - |
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" |
50 | | - Remove-Item "python" -Recurse |
51 | | - |
52 | | - # --- Verification Step --- |
53 | | - Write-Host "Verifying contents of python_runtime directory:" |
54 | | - Get-ChildItem -Path "python_runtime" |
55 | | - if (-not (Test-Path "python_runtime\python.exe")) { |
56 | | - Write-Host "CRITICAL ERROR: python.exe not found after extraction. Build cannot continue." |
57 | | - exit 1 |
58 | | - } |
59 | | - if (-not (Test-Path "python_runtime\Scripts\pip.exe")) { |
60 | | - Write-Host "CRITICAL ERROR: pip.exe not found after extraction. Build cannot continue." |
61 | | - exit 1 |
62 | | - } |
63 | | - Write-Host "Python runtime prepared successfully." |
64 | | -
|
65 | 30 | - name: Cache Pip and Nuitka |
66 | 31 | uses: actions/cache@v4 |
67 | 32 | with: |
|
72 | 37 | restore-keys: | |
73 | 38 | ${{ runner.os }}-pip- |
74 | 39 |
|
75 | | - - name: Install Nuitka and PySide6 |
| 40 | + - name: Install dependencies |
76 | 41 | run: pip install -r requirements.txt |
77 | 42 |
|
| 43 | + - name: Download zstd.exe decompressor |
| 44 | + shell: pwsh |
| 45 | + run: | |
| 46 | + Invoke-WebRequest -Uri "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip" -OutFile "zstd.zip" |
| 47 | + Expand-Archive -Path "zstd.zip" -DestinationPath "zstd" |
| 48 | + $env:PATH += ";${PWD}/zstd" |
| 49 | +
|
| 50 | + - name: Download Python standalone runtime |
| 51 | + shell: pwsh |
| 52 | + run: | |
| 53 | + $pythonVersion = "3.11.13" |
| 54 | + $releaseTag = "20250808" |
| 55 | + $fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-pgo-full.tar.zst" |
| 56 | + $url = "https://github.com/astral-sh/python-build-standalone/releases/download/$releaseTag/$fileName" |
| 57 | +
|
| 58 | + Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst" |
| 59 | +
|
| 60 | + - name: Decompress Python runtime |
| 61 | + shell: pwsh |
| 62 | + run: | |
| 63 | + .\zstd\zstd.exe -d python-standalone.tar.zst -o python-standalone.tar |
| 64 | + tar -xf python-standalone.tar |
| 65 | +
|
| 66 | + - name: Move to python_runtime folder |
| 67 | + shell: pwsh |
| 68 | + run: | |
| 69 | + New-Item -ItemType Directory -Force -Path python_runtime |
| 70 | + Move-Item -Path "python\install\*" -Destination "python_runtime" |
| 71 | + Remove-Item "python" -Recurse -Force |
| 72 | +
|
| 73 | + - name: Verify python_runtime |
| 74 | + shell: pwsh |
| 75 | + run: | |
| 76 | + if (-not (Test-Path "python_runtime\python.exe")) { exit 1 } |
| 77 | + if (-not (Test-Path "python_runtime\Scripts\pip.exe")) { exit 1 } |
| 78 | + |
| 79 | + - name: Upgrade pip in portable runtime |
| 80 | + shell: pwsh |
| 81 | + run: | |
| 82 | + .\python_runtime\python.exe -m pip install --upgrade pip |
| 83 | +
|
78 | 84 | - name: Build app with Nuitka |
79 | 85 | run: | |
80 | 86 | python -m nuitka ` |
|
99 | 105 | $build_dir = "NodeEditor_Build" |
100 | 106 | $dist_dir = Join-Path $build_dir "main.dist" |
101 | 107 | |
102 | | - $new_dir_name = "NodeEditor $version" |
103 | | - $zip_file_name = "NodeEditor_Windows_$version.zip" |
| 108 | + $new_dir_name = "PyFlowCanvas $version" |
| 109 | + $zip_file_name = "PyFlowCanvas_Windows_$version.zip" |
104 | 110 | |
105 | 111 | Rename-Item -Path $dist_dir -NewName $new_dir_name |
106 | 112 | |
|
0 commit comments