-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a task to create "templatized" release notes #28
Comments
Oh, I completely missed that there's now a |
Do you think the ChangeLog layout could be made configurable, e.g. via Kotlin scripting or FreeMarker? |
The change log is somewhat configurable. I have not gotten around to document it as I'm still trying it out in my own projects.
Output is limited to: Subheading Subheading Footer
It should be possible to change this to output HTML if you like. How would you like the output to be presented? What would be needed from a template file? |
That also looks quite nice. So far I was looking at https://github.com/requarks/changelog-action/releases.
No HTML please 😉 Markdown is just fine, as I'm looking for submitting the generated text to GitHub releases.
What I like about https://github.com/requarks/changelog-action is that it also lists the short commit SHA1 (as a clickable link) and the resolved issue, if any. And some grouping on scopes (per type) like JReleaser does would maybe also be nice. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This works for publishing release notes to Github using a linux runner. (I'm still having trouble with the emojis being replaced by "?" when using a windows runner. I think it's some encoding issue in powershell.) - name: Create GitHub release
if: "startsWith(github.ref, 'refs/tags/')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=$(git describe --tags --abbrev=0)
version=$(./gradlew -q printVersion)
./gradlew -q printChangeLog | gh release create $tag -t "MyApp $version" -F - |
Yes, thanks, I have something similar in place.
It's probably easier to debug when omitting some variable pieces and writing to a file (with UTF-8 encoding) instead of going through shell redirection... Anyway, shall I close this issue, as the task is there, and there's just the open question about if and how the changelog layout should be made more configurable? That could be discussed in a separate issue. |
I just found some inspiration. |
Yes, good inspiration but the mustache templates looks scary :-). semver {
changeLogSettings {
template {
Heading
BreakingChanges {
CommitMessage
}
ChangeList {
ChangeHeader
ChangeItem {
CommitHash
Scope("%s: ")
Text
}
}
Footer
}
}
} I never created a DSL like this so I'm a bit unsure how it could be done |
While I'm a big fan of Kotlin DSLs, for this use-case it could be a bit cumbersome to maintain. As soon as you'd introduce a new property in the data model, you'd need to also create an according DSL. That is, unless you use something like https://github.com/F43nd1r/autodsl or https://github.com/bipokot/Kabu 😆 |
I'm currently experimenting with a way to configure the change log like this: semver {
groupVersionIncrements = false
createReleaseTag = true
createReleaseCommit = true
//changeLogFormat = ChangeLogFormat.scopeChangeLog
changeLogFormat {
appendLine("# My changelog").appendLine()
withBreakingChanges {
appendLine("## Breaking changes")
format {
"- ${fullHeader()}"
}
appendLine()
}
withType("fix") {
appendLine("## Bug Fixes")
format {
"- ${scope()}${header()}"
}
appendLine()
}
withType("feat") {
appendLine("## Features")
format {
"- ${scope()}${header()}"
}
appendLine()
}
}
} and a more advanced example that first groups on type and then scope : {
appendLine(defaultHeader).appendLine()
withType("release") {
skip()
}
withBreakingChanges({
appendLine(defaultBreakingChangeHeader).appendLine()
groupByScope {
append("#### ").appendLine(key)
format {
"- ${hash()}${type()}${header()}"
}
appendLine()
}
withoutScope {
appendLine("#### Missing scope")
format {
"- ${hash()}${type()}${header()}"
}
appendLine()
}
appendLine()
})
groupBySorted({ defaultHeaderTexts[it.type].orEmpty() }, {
appendLine(key).appendLine()
groupByScope {
append("#### ").appendLine(key)
format {
"- ${hash()}${header()}"
}
appendLine()
}
withoutScope {
appendLine("#### Missing scope")
format {
"- ${hash()}${header()}"
}
appendLine()
}
appendLine()
})
otherwise({
appendLine(defaultOtherChangeHeader).appendLine()
groupByScope {
append("#### ").appendLine(key)
format {
"- ${hash()}${type()}${header()}"
}
appendLine()
}
withoutScope {
appendLine("#### Missing scope")
format {
"- ${hash()}${type()}${header()}"
}
appendLine()
}
appendLine()
})
}
```
The default format produces a change log very similar to the previous version.
You can group and filter the commits any way you like and the use some predefined formatting methods to create the change log text for the commit.
It is still missing functionality to access the author and commit time. I guess if you want the GitHub user name you need to access the GitHub API but I don't think I want to make the plugin specific to GitHub. |
How do you customize e.g. the top-most "What's Changed" header with the |
You either set the constant text
or if you have your custom format just append whatever you like:
There is a bit of documentation to do for the change log feature 😅 |
Maybe it can changed to something prettier 🤔 |
I agree. It doesn't feel right to alter a mutable global map to do this. IMO
|
Changed in 0.9.0 so now you could set the text like this:
How does it feel? |
Looks good! |
While what's currently implemented in not the fully templatized approach I had in mind originally, I feel that it's configurable enough, so let me close this. |
I'm not sure if this would be out of scope, but as the commits since the last tag are determined anyway, maybe grouping them by type as part of writing out a release notes files in Markdown format would make sense. Such a Markdown file could then be used for the notes as part of GitHub releases. This would avoid users of this plugin to additionally take something like https://github.com/requarks/changelog-action into use, and ensure that the interpretation of Conventinal Commits is exactly the same for bumping the version and creating the notes.
The text was updated successfully, but these errors were encountered: