Skip to content

Commit

Permalink
[release] Add release notes link on stable releases (#5780)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Aug 12, 2024
1 parent 83ecef8 commit 6ec1510
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions build/scripts/post-release.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function CreateDraftRelease {

$tagPrefix = $match.Groups[1].Value
$version = $match.Groups[2].Value
$isPrerelease = $version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc'

$projects = @(Get-ChildItem -Path src/**/*.csproj | Select-String "<MinVerTagPrefix>$tagPrefix</MinVerTagPrefix>" -List | Select Path)

Expand All @@ -22,6 +23,7 @@ function CreateDraftRelease {
}

$notes = ''
$previousVersion = ''

foreach ($project in $projects)
{
Expand All @@ -44,6 +46,11 @@ function CreateDraftRelease {
}
elseif ($line -like "## *" -and $started -eq $true)
{
$match = [regex]::Match($line, '^##\s*(.*)$')
if ($match.Success -eq $true)
{
$previousVersion = $match.Groups[1].Value
}
break
}
else
Expand All @@ -57,7 +64,7 @@ function CreateDraftRelease {

if ([string]::IsNullOrWhitespace($content) -eq $true)
{
$content = " No notable changes."
$content = " No notable changes."
}

$content = $content.trimend()
Expand All @@ -70,11 +77,19 @@ $content
See [CHANGELOG](https://github.com/$gitRepository/blob/$tag/src/$projectName/CHANGELOG.md) for details.
"@
}

if ($version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc')
if ($isPrerelease -eq $true)
{
$notes =
@"
The following changes are from the previous release [$previousVersion](https://github.com/$gitRepository/releases/tag/$tagPrefix$previousVersion).
"@ + $notes

gh release create $tag $releaseFiles `
--title $tag `
--verify-tag `
Expand All @@ -84,6 +99,15 @@ $content
}
else
{
$notes =
@"
For highlights and announcements pertaining to this release see: [Release Notes > $version](https://github.com/$gitRepository/blob/main/RELEASENOTES.md#$($version.Replace('.',''))).
The following changes are from the previous release [$previousVersion](https://github.com/$gitRepository/releases/tag/$tagPrefix$previousVersion).
"@ + $notes

gh release create $tag $releaseFiles `
--title $tag `
--verify-tag `
Expand Down

0 comments on commit 6ec1510

Please sign in to comment.