Skip to content

Commit 6b2006c

Browse files
committed
Generate release notes from commits
1 parent ebf5109 commit 6b2006c

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- name: Check out repository
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Set up MSBuild
2123
uses: microsoft/setup-msbuild@v2
@@ -41,6 +43,38 @@ jobs:
4143
"version=$version" >> $env:GITHUB_OUTPUT
4244
"asset_name=$asset" >> $env:GITHUB_OUTPUT
4345
46+
- name: Generate release notes
47+
id: release_notes
48+
if: github.ref_type == 'tag'
49+
shell: pwsh
50+
run: |
51+
$currentTag = "${{ steps.release_meta.outputs.version }}"
52+
$allTags = @(git tag --sort=creatordate)
53+
$currentIndex = [Array]::IndexOf($allTags, $currentTag)
54+
$previousTag = $null
55+
if ($currentIndex -gt 0) {
56+
$previousTag = $allTags[$currentIndex - 1]
57+
}
58+
59+
$notesPath = "dist\release-notes.txt"
60+
$lines = @("Changes in $currentTag", "")
61+
62+
if ($previousTag) {
63+
$lines += "Since ${previousTag}:"
64+
$commitLines = git log "$previousTag..$currentTag" --pretty=format:"- %s"
65+
} else {
66+
$lines += "Initial release:"
67+
$commitLines = git log "$currentTag" --pretty=format:"- %s"
68+
}
69+
70+
if (-not $commitLines) {
71+
$commitLines = @("- No commit subjects found.")
72+
}
73+
74+
$lines += $commitLines
75+
Set-Content -Path $notesPath -Value $lines
76+
"notes_path=$notesPath" >> $env:GITHUB_OUTPUT
77+
4478
- name: Upload packaged mod artifact
4579
uses: actions/upload-artifact@v4
4680
with:
@@ -53,5 +87,5 @@ jobs:
5387
with:
5488
tag_name: ${{ steps.release_meta.outputs.version }}
5589
name: ${{ steps.release_meta.outputs.version }}
56-
generate_release_notes: true
90+
body_path: ${{ steps.release_notes.outputs.notes_path }}
5791
files: dist/${{ steps.release_meta.outputs.asset_name }}

src/kc-accessibility/ScreenReaderLoadMod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
public class ScreenReaderLoadMod
66
{
77
private const string InitialAnnouncement = "Kingdoms and Castles loaded.";
8-
private const string BuildStamp = "0.2.3";
8+
private const string BuildStamp = "0.2.4";
99

1010
private static KCModHelper helper;
1111

src/kc-accessibility/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"Name": "kc-accessibility",
33
"Author": "chris",
44
"Description": "Adds screen-reader accessibility support for menus and gameplay.",
5-
"ModVersion": "0.2.3"
5+
"ModVersion": "0.2.4"
66
}

0 commit comments

Comments
 (0)