From f44116baa38212737808f2c6419960ff3e738ef3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 Aug 2025 01:42:42 +0300 Subject: [PATCH] Refactor release notes generation and version parsing Changed the version extraction regex in Get-VersionFromSetup for improved accuracy. Refactored New-ReleaseNotes to build the release notes string incrementally instead of using a here-string, simplifying formatting and maintenance. --- build/windows/windows-build-universal.ps1 | 55 ++++++++++------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/build/windows/windows-build-universal.ps1 b/build/windows/windows-build-universal.ps1 index 1b3297c..ccbcd27 100644 --- a/build/windows/windows-build-universal.ps1 +++ b/build/windows/windows-build-universal.ps1 @@ -38,7 +38,7 @@ $RELEASE_DATE = Get-Date -Format "yyyy-MM-dd" function Get-VersionFromSetup { try { $setupContent = Get-Content "build\windows\setup.py" -Raw - if ($setupContent -match 'version\s*=\s*["\']([^"\']+)["\']') { + if ($setupContent -match 'version="([^"]*)"') { $version = $matches[1] Write-Host "Detected version: $version" -ForegroundColor Gray return $version @@ -312,37 +312,28 @@ function Move-MSIFiles { function New-ReleaseNotes { Write-Step "Creating release notes..." - $releaseNotes = @" -# YTSage v$SCRIPT_VERSION Release - -**Release Date:** $RELEASE_DATE -**Build Type:** $BUILD_TYPE - -## Installation Options - -### MSI Installer (Recommended) -- **File:** $OUTPUT_NAME_BASE.msi -- **Installation:** Double-click to install system-wide -- **Updates:** Automatic update notifications -- **Uninstall:** Via Windows Programs & Features - -### Portable ZIP -- **File:** $OUTPUT_NAME_BASE.zip -- **Installation:** Extract and run - no installation required -- **Updates:** Manual download and replacement -- **Uninstall:** Simply delete the folder - -## System Requirements -- Windows 10/11 (64-bit) -- .NET Framework 4.7.2 or later -- Internet connection for yt-dlp updates - -## Support -For issues or questions, please visit the project repository. - ---- -*Built with cx_Freeze v$(pip show cx_Freeze | Select-String "Version" | ForEach-Object { ($_ -split ":")[1].Trim() })* -"@ + $releaseNotes = "# YTSage v$SCRIPT_VERSION Release`n`n" + $releaseNotes += "**Release Date:** $RELEASE_DATE`n" + $releaseNotes += "**Build Type:** $BUILD_TYPE`n`n" + $releaseNotes += "## Installation Options`n`n" + $releaseNotes += "### MSI Installer (Recommended)`n" + $releaseNotes += "- **File:** $OUTPUT_NAME_BASE.msi`n" + $releaseNotes += "- **Installation:** Double-click to install system-wide`n" + $releaseNotes += "- **Updates:** Automatic update notifications`n" + $releaseNotes += "- **Uninstall:** Via Windows Programs `& Features`n`n" + $releaseNotes += "### Portable ZIP`n" + $releaseNotes += "- **File:** $OUTPUT_NAME_BASE.zip`n" + $releaseNotes += "- **Installation:** Extract and run - no installation required`n" + $releaseNotes += "- **Updates:** Manual download and replacement`n" + $releaseNotes += "- **Uninstall:** Simply delete the folder`n`n" + $releaseNotes += "## System Requirements`n" + $releaseNotes += "- Windows 10/11 64-bit`n" + $releaseNotes += "- .NET Framework 4.7.2 or later`n" + $releaseNotes += "- Internet connection for yt-dlp updates`n`n" + $releaseNotes += "## Support`n" + $releaseNotes += "For issues or questions, please visit the project repository.`n`n" + $releaseNotes += "---`n" + $releaseNotes += "*Built with cx_Freeze*`n" try { $releaseNotesPath = Join-Path $OutputDir "RELEASE_NOTES.md"