diff --git a/scripts/publish-release.ps1 b/scripts/publish-release.ps1 index e06e122..7385457 100644 --- a/scripts/publish-release.ps1 +++ b/scripts/publish-release.ps1 @@ -81,12 +81,18 @@ $Release = $ExistingReleases | Where-Object { $_.tag_name -eq $TagName } if (-not $Release) { $Utf8NoBom = New-Object System.Text.UTF8Encoding($false) - $Changelog = [System.IO.File]::ReadAllText((Join-Path $ProjectRoot "CHANGELOG.md"), $Utf8NoBom) + $FullChangelog = [System.IO.File]::ReadAllText((Join-Path $ProjectRoot "CHANGELOG.md"), $Utf8NoBom) + $VersionPattern = "(?s)## \[$([regex]::Escape($Version))\].*?(?=(?:\r?\n## \[|\z))" + if ($FullChangelog -match $VersionPattern) { + $ReleaseBody = $matches[0].Trim() + } else { + $ReleaseBody = $FullChangelog + } $PayloadPath = Join-Path $DistDir "release_req.json" $Payload = @{ tag_name = $TagName name = "Sanctum $TagName (Windows & Linux x86_64)" - body = $Changelog + body = $ReleaseBody draft = $false prerelease = $false } | ConvertTo-Json -Depth 5