Skip to content

Commit f42fe37

Browse files
committed
fix: transport release-notes to gh-release
approach via tag-message does not work, not quite sure why.
1 parent f669eb1 commit f42fe37

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ jobs:
8989
find app/build/collected-binaries -type f -name "spotless*" -exec chmod +x {} \;
9090
- name: "Prepare release zips for distribution"
9191
run: "./gradlew -Prelease=true -PreleaseForceVersion=${{ github.event.inputs.force_version }} -PreleaseBinariesRootDir=app/build/collected-binaries prepareReleaseBinaryZips"
92+
- name: "Get changelog of latest release to file"
93+
run: |
94+
echo "$(./gradlew changelogPrintLatestVersionContent -Prelease=true -PreleaseForceVersion=${{ github.event.inputs.force_version }} --quiet)" > "app/build/release-notes.md"
9295
- name: "Create release"
9396
run: "./gradlew -Prelease=true -PreleaseForceVersion=${{ github.event.inputs.force_version }} -PreleaseBinariesRootDir=app/build/collected-binaries changelogPush"
9497
env:

build-logic/src/main/groovy/buildlogic.changelog-conventions.gradle

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ spotlessChangelog {
1313
forceNextVersion project.releaseForceVersion
1414
}
1515
commitMessage "Published v{{version}}"
16-
tagMessage "{{changes}}"
1716
tagPrefix "v"
1817
// https://cli.github.com/manual/gh_release_create
19-
runAfterPush "gh release create v{{version}} --title 'spotless-cli v{{version}}' --notes-from-tag ${getPathsOfReleaseBinaryZips().join(' ')}"
18+
runAfterPush "gh release create v{{version}} --title 'spotless-cli v{{version}}' --notes-file app/build/release-notes.md --verify-tag ${getPathsOfReleaseBinaryZips().join(' ')}"
2019
}
2120

2221
version = spotlessChangelog.versionNext
@@ -35,6 +34,19 @@ tasks.register('changelogPrintUnreleasedVersionContent') {
3534
}
3635
}
3736

37+
tasks.register('changelogPrintLatestVersionContent') {
38+
def changelog = spotlessChangelog.parsedChangelog
39+
doLast {
40+
String changelogString = changelog.toStringUnix()
41+
String changeLog = changelogString.lines()
42+
.dropWhile { String line -> !line.startsWith("## [") } // latest version
43+
.skip(1) // skip the version line
44+
.takeWhile { String line -> !line.startsWith("## [") }
45+
.toList()
46+
.join("\n")
47+
println "${changeLog}"
48+
}
49+
}
3850
tasks.register('changelogPrintVersionContent') {
3951
def changelog = spotlessChangelog.parsedChangelog
4052
if (!project.hasProperty('changelogPrintVersion') || project.changelogPrintVersion == '') {

0 commit comments

Comments
 (0)