Skip to content

test

test #18

Workflow file for this run

# .github/workflows/windows-build.yml
# GitHub Actions workflow to build a standalone Windows executable and create a release.
# This version correctly downloads and prepares a full, portable Python runtime.
name: Build and Release Windows App
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0
jobs:
build-windows:
runs-on: windows-latest
permissions:
contents: write # To create the release
pull-requests: read # To read PRs for the changelog
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python for Nuitka build process
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache Pip and Nuitka
uses: actions/cache@v4
with:
path: |
~\.cache\pip
~\AppData\Local\Nuitka\Nuitka\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt
- name: Download zstd.exe decompressor
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip" -OutFile "zstd.zip"
Expand-Archive -Path "zstd.zip" -DestinationPath "zstd"
$env:PATH += ";${PWD}/zstd"
- name: Download Python standalone runtime
shell: pwsh
run: |
$pythonVersion = "3.11.13"
$releaseTag = "20250808"
$fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-pgo-full.tar.zst"
$url = "https://github.com/astral-sh/python-build-standalone/releases/download/$releaseTag/$fileName"
Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst"
- name: Decompress Python runtime
shell: pwsh
run: |
# BUG FIX: The zstd executable is in a nested directory after extraction.
# Use the correct path to the executable.
.\zstd\zstd-v1.5.5-win64\zstd.exe -d python-standalone.tar.zst -o python-standalone.tar
tar -xf python-standalone.tar
- name: Move to python_runtime folder
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path python_runtime
Move-Item -Path "python\install\*" -Destination "python_runtime"
Remove-Item "python" -Recurse -Force
- name: Verify python_runtime
shell: pwsh
run: |
if (-not (Test-Path "python_runtime\python.exe")) { exit 1 }
if (-not (Test-Path "python_runtime\Scripts\pip.exe")) { exit 1 }
- name: Upgrade pip in portable runtime
shell: pwsh
run: |
.\python_runtime\python.exe -m pip install --upgrade pip
- name: Build app with Nuitka
run: |
python -m nuitka `
--standalone `
--enable-plugin=pyside6 `
--include-qt-plugins=platforms `
--output-dir=NodeEditor_Build `
--nofollow-import-to=tkinter,unittest,setuptools,pip,wheel `
--windows-disable-console `
--remove-output `
--lto=yes `
--include-data-dir=examples=examples `
--include-data-file=dark_theme.qss=dark_theme.qss `
--include-data-dir=python_runtime=python_runtime `
--assume-yes-for-downloads `
main.py
- name: Prepare artifact for release
id: package
run: |
$version = "${{ github.ref_name }}"
$build_dir = "NodeEditor_Build"
$dist_dir = Join-Path $build_dir "main.dist"
$new_dir_name = "PyFlowCanvas $version"
$zip_file_name = "PyFlowCanvas_Windows_$version.zip"
Rename-Item -Path $dist_dir -NewName $new_dir_name
$archive_source = Join-Path $build_dir $new_dir_name
Compress-Archive -Path "$archive_source\*" -DestinationPath $zip_file_name
echo "zip_name=$zip_file_name" >> $env:GITHUB_OUTPUT
- name: Generate changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: |
## What's Changed
---
${{ steps.changelog.outputs.changelog }}
files: ${{ steps.package.outputs.zip_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}