diff --git a/.github/scripts/release-notes.ps1 b/.github/scripts/release-notes.ps1 index dbbea3f..4becbfe 100644 --- a/.github/scripts/release-notes.ps1 +++ b/.github/scripts/release-notes.ps1 @@ -35,52 +35,50 @@ function Get-PreviousTag return ($tag | Select-Object -First 1).Trim() } -$baseTag = $null -$rangeDescription = $null - -if ($stage -eq "rc") +function Get-LatestStableTag { - $ptrTags = @(& git tag --merged HEAD --sort=version:refname --list "v$productVersion-ptr.*") + $tags = @( + & git tag --merged HEAD --sort=-version:refname --list "v*" | + Where-Object { $_ -match '^v\d+\.\d+\.\d+$' } + ) - if ($ptrTags.Count -gt 0) + if ($tags.Count -eq 0) { - $firstPtrTag = $ptrTags[0].Trim() - $baseTag = Get-PreviousTag "$firstPtrTag^" - } - else - { - $baseTag = Get-PreviousTag "HEAD^" + return $null } - $rangeDescription = "Includes all changes from the PTR phase through this release." + return $tags[0].Trim() } -elseif ([string]::IsNullOrWhiteSpace($stage)) + +$previousTag = Get-PreviousTag "HEAD^" +$baseTag = $null +$rangeDescription = $null +$sameStageAsPreviousRelease = $false + +if (![string]::IsNullOrWhiteSpace($stage) -and $null -ne $previousTag -and + $previousTag -match '^v(?\d+\.\d+\.\d+)-(?dev|alpha|ptr|rc)\.\d+$') { - $stableTags = @( - & git tag --merged HEAD --sort=-version:refname --list "v*" | - Where-Object { $_ -match '^v\d+\.\d+\.\d+$' } - ) + $sameStageAsPreviousRelease = + $Matches["product"] -eq $productVersion -and + $Matches["stage"] -eq $stage +} - if ($stableTags.Count -gt 0) - { - $baseTag = $stableTags[0].Trim() - $rangeDescription = "Includes all changes since $baseTag." - } - else - { - $rangeDescription = "Includes all changes since the beginning of the project." - } +if ($sameStageAsPreviousRelease) +{ + $baseTag = $previousTag + $rangeDescription = "Includes changes since $baseTag." } else { - $baseTag = Get-PreviousTag "HEAD^" + $baseTag = Get-LatestStableTag + $rangeDescription = if ($null -eq $baseTag) { - "Includes all changes since the beginning of the project." + "Includes all changes in the $productVersion release cycle since the beginning of the project." } else { - "Includes changes since $baseTag." + "Includes all changes in the $productVersion release cycle since $baseTag." } } diff --git a/README.md b/README.md index df4bcfb..4dd2696 100644 --- a/README.md +++ b/README.md @@ -216,14 +216,9 @@ The release workflow: `dev`, `alpha`, `ptr`, and `rc` builds are marked as GitHub pre-releases. Stable versions such as `1.0.0` are normal releases. -Release notes are intentionally cumulative where that is useful: +Release notes are stage-aware. Consecutive releases within the same prerelease stage describe only the changes since the previous release. The first release of a prerelease stage contains the full current product-version cycle since the previous stable release, or since the beginning of the project when no stable release exists. Stable releases are also cumulative since the previous stable release. This gives existing testers concise incremental notes while giving testers entering at a new maturity level a complete view of the release. -- `dev`, `alpha`, and `ptr` builds describe changes since the previous tag; -- RC builds contain all changes from the beginning of the current PTR phase through that RC; -- stable releases contain all changes since the previous stable release; -- commits without an associated pull request are listed separately so changes are not silently lost. - -For associated pull requests, both the PR title and PR description are included in the release notes. +Commits without an associated pull request are listed separately so changes are not silently lost. For associated pull requests, both the PR title and PR description are included in the release notes. ## Development