1+ name : Build & Release
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : write
11+
12+ env :
13+ QT_VERSION : " 6.10.2"
14+ PYTHON_VERSION : " 3.11"
15+ BUILD_TYPE : Release
16+
17+ jobs :
18+ build-windows :
19+ runs-on : windows-latest
20+ steps :
21+ - uses : actions/checkout@v4
22+ with :
23+ submodules : recursive
24+
25+ - name : List available Qt tools (debug)
26+ run : pip install aqtinstall && aqt list-tool windows desktop
27+
28+ - name : Install Qt
29+ uses : jurplel/install-qt-action@v4
30+ with :
31+ version : ${{ env.QT_VERSION }}
32+ host : windows
33+ target : desktop
34+ arch : win64_mingw
35+ modules : qtmultimedia qtshadertools qtwebview
36+ tools : tools_mingw1310
37+ cache : true
38+
39+ - name : Set up Python ${{ env.PYTHON_VERSION }}
40+ uses : actions/setup-python@v5
41+ with :
42+ python-version : ${{ env.PYTHON_VERSION }}
43+
44+ - name : Install Python packages
45+ run : pip install -r python/requirements.txt
46+
47+ - name : Download WebView2 SDK
48+ shell : pwsh
49+ run : |
50+ nuget install Microsoft.Web.WebView2 -OutputDirectory wv2_pkg
51+ $wv2Dir = Get-ChildItem -Path wv2_pkg -Filter "Microsoft.Web.WebView2.*" -Directory | Select-Object -First 1
52+ $destBase = "third_party/webview2/sdk/build/native"
53+ New-Item -ItemType Directory -Path "$destBase/include" -Force | Out-Null
54+ New-Item -ItemType Directory -Path "$destBase/x64" -Force | Out-Null
55+ Copy-Item "$($wv2Dir.FullName)/build/native/include/*" "$destBase/include/" -Recurse -Force
56+ Copy-Item "$($wv2Dir.FullName)/build/native/x64/*" "$destBase/x64/" -Recurse -Force
57+ Write-Host "WebView2 SDK installed to $destBase"
58+
59+ - name : Configure CMake
60+ shell : pwsh
61+ run : |
62+ # Qt's bundled MinGW is installed under Qt\Tools\mingw*\bin
63+ $qtBase = (Get-Item "$env:QT_ROOT_DIR").Parent.Parent.FullName
64+ $toolsDir = Join-Path $qtBase "Tools"
65+ Write-Host "Searching: $toolsDir"
66+
67+ $mingwDir = Get-ChildItem $toolsDir -Directory -ErrorAction SilentlyContinue |
68+ Where-Object { $_.Name -like "mingw*" } |
69+ Sort-Object Name -Descending |
70+ Select-Object -First 1
71+
72+ if (-not $mingwDir) { Write-Error "Qt MinGW not found in $toolsDir"; exit 1 }
73+
74+ $mingwBin = "$($mingwDir.FullName)\bin"
75+ Write-Host "Using MinGW bin : $mingwBin"
76+
77+ # Sanity check — must NOT be the system C:\mingw64
78+ if ($mingwBin -like "C:\mingw64*") {
79+ Write-Error "Resolved to system MinGW — ABI mismatch with Qt libs. Check tools : in install-qt-action."
80+ exit 1
81+ }
82+
83+ cmake -B build -G "Ninja" `
84+ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
85+ -DCMAKE_CXX_COMPILER="$mingwBin\g++.exe" `
86+ -DCMAKE_C_COMPILER="$mingwBin\gcc.exe" `
87+ -DQt6_DIR="$env:Qt6_DIR" `
88+ -DPython3_ROOT_DIR="$env:pythonLocation" `
89+ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--allow-multiple-definition"
90+
91+ - name : Build
92+ shell : pwsh
93+ run : cmake --build build --config ${{ env.BUILD_TYPE }}
94+
95+ - name : Deploy Qt runtime
96+ shell : pwsh
97+ run : |
98+ $exe = Get-ChildItem -Path "build" -Filter "CapScriptPro.exe" -Recurse | Select-Object -First 1
99+ if (-not $exe) { Write-Error "CapScriptPro.exe not found"; exit 1 }
100+
101+ # windeployqt lives beside the Qt kit, not on C:\
102+ $windeployqt = Join-Path $env:QT_ROOT_DIR "bin\windeployqt.exe"
103+ if (-not (Test-Path $windeployqt)) { Write-Error "windeployqt not found at $windeployqt"; exit 1 }
104+
105+ Write-Host "Deploying Qt for $($exe.FullName)"
106+ & $windeployqt $exe.FullName --no-translations --no-system-d3d-compiler --no-opengl-sw
107+
108+ - name : Create release archive
109+ shell : pwsh
110+ run : |
111+ $exePath = (Get-ChildItem -Path "build" -Filter "CapScriptPro.exe" -Recurse | Select-Object -First 1).FullName
112+ $exeDir = [System.IO.Path]::GetDirectoryName($exePath)
113+ Write-Host "Archiving contents of $exeDir"
114+ Compress-Archive -Path "$exeDir\*" -DestinationPath "CapScriptPro-Windows-x64.zip"
115+
116+ - name : Upload artifact
117+ uses : actions/upload-artifact@v4
118+ with :
119+ name : CapScriptPro-Windows-x64
120+ path : CapScriptPro-Windows-x64.zip
121+
122+ release :
123+ needs : [build-windows]
124+ runs-on : ubuntu-latest
125+ if : startsWith(github.ref, 'refs/tags/v')
126+ steps :
127+ - uses : actions/download-artifact@v4
128+ with :
129+ merge-multiple : true
130+
131+ - name : Create Release
132+ uses : softprops/action-gh-release@v2
133+ with :
134+ draft : true
135+ generate_release_notes : true
136+ files : |
137+ CapScriptPro-Windows-x64.zip
0 commit comments