Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] Add release notes link on stable releases #5780

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
vishweshbankwar marked this conversation as resolved.
Show resolved Hide resolved


"@ + $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