Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Release notes: one What's Changed section, without the code signing line

KnifeLemon12b3672562db
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c72edec0..aff3eb6d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -71,7 +71,6 @@ jobs:
run: |
$version = '${{ steps.version.outputs.value }}'
$files = Get-ChildItem Releases -File -Filter "Filee-$version-*" | ForEach-Object FullName
- $policy = "**Code signing policy:** ${{ github.server_url }}/${{ github.repository }}#code-signing-policy"
# "## 1.4.0" up to the next "## " heading of CHANGELOG.md, without the heading itself.
$changes = ''
$changelog = Get-Content CHANGELOG.md -Raw -Encoding utf8
@@ -80,7 +79,20 @@ jobs:
$changes = $Matches[1].Trim() -replace '\r?\n (?=\S)', ' '
}
if (-not $changes) { Write-Warning "CHANGELOG.md has no section for $version" }
- $notes = if ($changes) { "$policy`n`n$changes" } else { $policy }
+
+ # GitHub's generated notes: the merged pull requests (one list instead of its label headings, which would
+ # repeat the CHANGELOG's), new contributors and the full changelog link.
+ $generated = (gh api -X POST "repos/${{ github.repository }}/releases/generate-notes" -f tag_name='${{ github.ref_name }}' | ConvertFrom-Json).body
+ $prs = @()
+ if ($generated -match "(?ms)^## What's Changed[ \t]*\r?\n(.*?)(?=^## |^\*\*Full Changelog|\z)") {
+ $prs = @($Matches[1] -split '\r?\n' | Where-Object { $_ -match '^\* ' })
+ }
+ $tail = if ($generated -match "(?ms)(^## New Contributors.*|^\*\*Full Changelog.*)") { $Matches[1].Trim() } else { '' }
+
+ $parts = @("## What's Changed")
+ if ($changes) { $parts += $changes }
+ if ($prs.Count) { $parts += "### Pull requests`n`n" + ($prs -join "`n") }
+ if ($tail) { $parts += $tail }
$notesFile = Join-Path $env:RUNNER_TEMP 'notes.md'
- Set-Content $notesFile $notes -Encoding utf8
- gh release create '${{ github.ref_name }}' --title "Filee $version" --notes-file $notesFile --generate-notes --verify-tag @files
+ Set-Content $notesFile ($parts -join "`n`n") -Encoding utf8
+ gh release create '${{ github.ref_name }}' --title "Filee $version" --notes-file $notesFile --verify-tag @files
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36f4175a..440048d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,7 @@
# Changelog
What changed in each version of Filee, for the people using it. The release workflow puts the section of the
-version it publishes at the top of the GitHub release notes, above the list of pull requests.
+version it publishes under "What's Changed" in the GitHub release notes, above the list of pull requests.
Add a `## <version>` section before tagging a release. Write what someone using Filee notices: what's new, where to
find it, what it does and doesn't do.