From e95ae726491b949e285f4d0a90a52fc6777b6337 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Thu, 2 May 2024 12:46:03 -0700 Subject: [PATCH] [repo] Release process tweaks & improvements 2 (#5587) --- .github/workflows/publish-packages-1.0.yml | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index 3a7c7185bf4..0b402dffe49 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -73,13 +73,51 @@ jobs: if ($firstPackageVersion -eq '') { - $firstPackageVersion = $packageVersion + $firstPackageVersion = $packageVersion } + $changelogContent = Get-Content -Path "src/$packageName/CHANGELOG.md" + + $headingWritten = $false + $started = $false + $content = "" + + foreach ($line in $changelogContent) + { + if ($line -like "## ${{ github.ref_name }}" -and $started -ne $true) + { + $started = $true + } + elseif ($line -like "Released *" -and $started -eq $true) + { + continue + } + elseif ($line -like "## *" -and $started -eq $true) + { + break + } + else + { + if ($started -eq $true -and ([string]::IsNullOrWhitespace($line) -eq $false -or $content.Length -gt 0)) + { + $content += " " + $line + "`r`n" + } + } + } + + if ([string]::IsNullOrWhitespace($content) -eq $true) + { + $content = " No notable changes." + } + + $content = $content.trimend() + $notes += @" * NuGet: [$packageName v$packageVersion](https://www.nuget.org/packages/$packageName/$packageVersion) + $content + See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/src/$packageName/CHANGELOG.md) for details. "@