From 17ec207852646f34f64198d5e24ba2da9fbeac70 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 Aug 2025 13:55:04 +0300 Subject: [PATCH] Improve Windows build workflow error handling Adds error handling to MSI installer creation steps in the Windows build workflow to prevent failures from stopping subsequent ZIP creation. Updates ZIP creation logic to use the dist output directory. Removes the install_icon option from setup.py to address potential MSI build issues. --- .github/workflows/build-windows.yml | 44 +++++++++++++++++++++-------- build/windows/setup.py | 3 +- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 38bc202..599f842 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -86,15 +86,24 @@ jobs: # Build executable python build\windows\setup.py build - # Build MSI installer - python build\windows\setup.py bdist_msi + # Build MSI installer with error handling + Write-Host "Building standard MSI installer..." + try { + python build\windows\setup.py bdist_msi + Write-Host "Standard MSI build completed successfully" + } catch { + Write-Host "Error building standard MSI: $($_.Exception.Message)" + # Continue anyway to try ZIP creation + } - # Create ZIP distribution - $exeDir = Get-ChildItem -Path "build" -Directory -Filter "exe.*" | Select-Object -First 1 - if ($exeDir) { + # Create ZIP distribution from dist output + $distDir = "dist\YTSage" + if (Test-Path $distDir) { $version = "${{ steps.get_version.outputs.VERSION }}" - Compress-Archive -Path "$($exeDir.FullName)\*" -DestinationPath "dist\YTSage-v$version.zip" -Force + Compress-Archive -Path "$distDir\*" -DestinationPath "dist\YTSage-v$version.zip" -Force Write-Host "Created ZIP: YTSage-v$version.zip" + } else { + Write-Host "Warning: Standard executable directory not found at $distDir" } - name: Setup FFmpeg for bundle @@ -160,14 +169,25 @@ jobs: # Build executable with FFmpeg python build\windows\setup-ffmpeg.py build - # Build MSI installer with FFmpeg - python build\windows\setup-ffmpeg.py bdist_msi + # Build MSI installer with FFmpeg and error handling + Write-Host "Building FFmpeg MSI installer..." + try { + python build\windows\setup-ffmpeg.py bdist_msi + Write-Host "FFmpeg MSI build completed successfully" + } catch { + Write-Host "Error building FFmpeg MSI: $($_.Exception.Message)" + # Continue anyway to try ZIP creation + } - # Create ZIP distribution with FFmpeg - $exeDir = Get-ChildItem -Path "build" -Directory -Filter "exe.*" | Select-Object -First 1 - if ($exeDir) { + # Create ZIP distribution with FFmpeg from dist output + $distDir = "dist\YTSage-FFmpeg" + if (Test-Path $distDir) { $version = "${{ steps.get_version.outputs.VERSION }}" - Compress-Archive -Path "$($exeDir.FullName)\*" -DestinationPath "dist\YTSage-v$version-ffmpeg.zip" -Force + Compress-Archive -Path "$distDir\*" -DestinationPath "dist\YTSage-v$version-ffmpeg.zip" -Force + Write-Host "Created ZIP: YTSage-v$version-ffmpeg.zip" + } else { + Write-Host "Warning: FFmpeg executable directory not found at $distDir" + } Write-Host "Created ZIP: YTSage-v$version-ffmpeg.zip" } diff --git a/build/windows/setup.py b/build/windows/setup.py index cc16372..56ba639 100644 --- a/build/windows/setup.py +++ b/build/windows/setup.py @@ -74,7 +74,8 @@ bdist_msi_options = { "upgrade_code": "{12345678-1234-5678-9ABC-123456789ABC}", # Generate unique GUID "add_to_path": False, "initial_target_dir": r"[ProgramFilesFolder]\YTSage", - "install_icon": "assets/branding/icons/YTSage.ico", + # Remove problematic install_icon that might be causing MSI build to fail + # "install_icon": "assets/branding/icons/YTSage.ico", "summary_data": { "author": "oop7", "comments": "YouTube Video Downloader - Easy to use video downloading tool",