name: Build and Release FLUX Windows on: push: tags: - 'v*' # Si attiva solo quando crei un tag tipo v1.0.0 jobs: build: runs-on: windows-native # Richiama esattamente l'etichetta del PC del collega steps: - name: Checkout del codice uses: actions/checkout@v3 # 1. Pre-build per generare i symlink (Fallirà apposta) - name: Pre-build per generare l'ambiente continue-on-error: true run: flutter build windows --release # 2. Il Fix Definitivo con .NET - name: Fix bug CMake di pdfx (Patcha la vera Pub Cache) run: | $file = "windows\flutter\ephemeral\.plugin_symlinks\pdfx\windows\DownloadProject.cmake" if (Test-Path $file) { # Usiamo [IO.File] del .NET Framework! # Questo segue il symlink in modo trasparente e modifica il VERO file originale nella Pub Cache. $text = [IO.File]::ReadAllText($file) $text = $text.Replace("VERSION 2.8.2", "VERSION 3.5") [IO.File]::WriteAllText($file, $text) Write-Host "Il VERO file nella Pub Cache è stato patchato in modo permanente!" } else { Write-Error "File non trovato. La pre-build non ha generato i symlink." exit 1 } # Pialliamo la cache sporca di CMake del tentativo precedente if (Test-Path "build\windows") { Remove-Item -Recurse -Force "build\windows" Write-Host "Cartella build sporca eliminata." } # 3. Ora la build vera non può fallire, perché il sorgente di pdfx è stato curato alla radice - name: Build Flutter Definitiva env: CMAKE_BUILD_PARALLEL_LEVEL: 2 run: flutter build windows --release - name: Compila Installer Inno Setup run: | $TagVersion = "${{ gitea.ref_name }}".Substring(1) "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DMyAppVersion=$TagVersion "win_installer.iss" # Usa un'action standard per caricare il file su Gitea Releases - name: Upload Release Asset uses: https://gitea.com/actions/release-action@main with: files: "build/windows/installer/FLUX_Setup_x64.exe" api_key: ${{ secrets.GITEA_TOKEN }} - name: Pulisci Workspace if: always() # Esegue questo step anche se la build fallisce run: Remove-Item -Recurse -Force ./*