From fca711e1a888ec10b7f6ab5c8ab70c96ef4c11d6 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Sun, 20 Jul 2025 05:40:10 +1000 Subject: [PATCH] !build automation testing --- .github/workflows/build-windows.yml | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 3271876..5d75241 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -136,34 +136,44 @@ jobs: # Generate commit history since last tag (or all commits if no tag) $commitRange = if ($latestTag) { "$latestTag..HEAD" } else { "HEAD" } - $commitHistory = "" # Get commits with format: short hash, subject, author $commits = & git log $commitRange --pretty=format:"%h|%s|%an" --no-merges + # Create a temporary file to store commit history + $tempFile = [System.IO.Path]::GetTempFileName() + if ($commits) { - $commitHistory = "`n`n## Changes Since Last Release`n" + "## Changes Since Last Release" | Out-File -FilePath $tempFile -Encoding UTF8 + "" | Out-File -FilePath $tempFile -Append -Encoding UTF8 + $commits | ForEach-Object { $parts = $_ -split '\|', 3 $hash = $parts[0] - $subject = $parts[1] + $subject = $parts[1] -replace '"', '\"' $author = $parts[2] $commitUrl = "https://github.com/${{ github.repository }}/commit/$hash" - $commitHistory += "- [$hash]($commitUrl) $subject (by $author)`n" + "- [$hash]($commitUrl) $subject (by $author)" | Out-File -FilePath $tempFile -Append -Encoding UTF8 } } else { - $commitHistory = "`n`n## Changes Since Last Release`nNo new commits since last release.`n" + "## Changes Since Last Release" | Out-File -FilePath $tempFile -Encoding UTF8 + "" | Out-File -FilePath $tempFile -Append -Encoding UTF8 + "No new commits since last release." | Out-File -FilePath $tempFile -Append -Encoding UTF8 } - # Escape special characters for GitHub output - $commitHistoryEscaped = $commitHistory -replace '"', '\"' -replace '`', '\`' - - # Set outputs for use in next steps + # Set outputs for use in next steps using multiline syntax echo "tag=$tag" >> $env:GITHUB_OUTPUT echo "release_name=$releaseName" >> $env:GITHUB_OUTPUT echo "short_sha=$shortSha" >> $env:GITHUB_OUTPUT echo "build_number=$buildNumber" >> $env:GITHUB_OUTPUT - echo "commit_history=$commitHistoryEscaped" >> $env:GITHUB_OUTPUT + + # Use heredoc syntax for multiline commit history + echo "commit_history<> $env:GITHUB_OUTPUT + Get-Content $tempFile | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 + echo "EOF" >> $env:GITHUB_OUTPUT + + # Clean up temp file + Remove-Item $tempFile - name: Download Windows Build uses: actions/download-artifact@v4 with: