chore(scripts): extract version-specific changelog section for release body
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user