Docs(core): adjust changelog generation (#924)

This commit is contained in:
Thomas Kohler 2023-05-21 14:58:49 +02:00 committed by GitHub
parent 949392d8a7
commit 743c6676e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2655 additions and 1119 deletions

View File

@ -1,12 +1,28 @@
{{ range .Versions }}
{{ if .Tag.Previous }}{{ .Tag.Name }}{{ else }}{{ .Tag.Name }}{{ end }}
---
{{ range .CommitGroups -}}
* **{{ .Title }}**
# {{ .Info.Title }}
{{ range .Commits -}}
* {{ if .Scope }}**>{{ .Scope }}:<** {{ end }}{{ .Subject }}
{{ end }}
Please adjust manually before add content to CHANGELOG.md.
{{ if .Versions -}}
## [Unreleased]({{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD)
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ range .Versions }}## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{- if .NoteGroups -}}

View File

@ -4,39 +4,73 @@
We using <https://github.com/git-chglog/git-chglog>, so refer to this side for installation instructions.
It is possible to test the tool by `git-chglog --init` without overriding anything.
## Usage
Example for a new release "v2.0.0":
Example for a new release "v2.0.1":
```sh
git checkout release
git pull
git fetch --tags
git-chglog --no-case --next-tag 2.0.0 v1.16.0.. > .chglog/chglog_tmp.md
git checkout dev
git pull upstream dev
git-chglog --config .chglog/config_gobot.yml --no-case --next-tag v2.0.1 v2.0.0.. > .chglog/chglog_tmp.md
```
## Compare
If unsure about any result of running git-chglog, just use:
`git log --since=2022-05-02 --pretty="- %s`
`git log --since=2022-05-15 --pretty="- %s`
## Manual adjustment
Because there is no commit style guide yet, some manual work is needed to bring the items in the correct position.
Please refer to the current CHANGELOG.md to find the correct way. In general we try to use this style:
Most likely some manual work is needed to bring the items in the correct position. We use the style from
["keep a changelog"](https://keepachangelog.com/en/1.1.0/), together with the [standard template](https://github.com/git-chglog/example-type-scope-subject/blob/master/CHANGELOG.standard.md).
The changelog will be generated based on the commit messages, so please follow the
[Convention for Pull Request Descriptions](../CONTRIBUTING.md).
* titles will be converted to lower case
* titles are lexical ordered
* each platform has its own title (e.g. **raspi**)
* fixes has the title **bugfix**
* title **api**, **drivers** or **example** is used for changes below related folder
* title **core** is used for changes of common code, e.g. utilities, system
* further special titles **build**, **docs** and **test** can be used
An example for the following commits:
* type(scope): description
* i2c(PCF8583): added
* gpio(HD44780): fix wrong constants
* raspi(PWM): refactor usage
* docs(core): usage of Kernel driver
* or alternative: core(docs): usage of Kernel driver
* build(style): adjust rule for golangci-lint
```md
### build
* **style**: adjust rule for golangci-lint
### docs
* **core**: usage of Kernel driver
### i2c
* **PCF8583**: added
### gpio
* **HD44780**: fix wrong constants
### raspi
* **PWM**: refactor usage
### Type
* **scope:** description
```
If in doubt, please refer to the current CHANGELOG.md to find the correct way.
## Finalization
After all work is done in the temporary changelog file, the content can be moved to the real one and the "chglog_tmp.md"
file can be removed.
## TODO's
* introduce a commit style guide
* convert the changelog format to a more common style, see <https://github.com/git-chglog/example-type-scope-subject/tree/master>

View File

@ -1,28 +0,0 @@
style: github
template: CHANGELOG.gobot.md
info:
title: CHANGELOG
repository_url: https://github.com/hybridgroup/gobot
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:?\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE

15
.chglog/config_gobot.yml Executable file
View File

@ -0,0 +1,15 @@
style: github
template: CHANGELOG.gobot.md
info:
title: Auto-Generated Changelog
repository_url: https://github.com/hybridgroup/gobot
options:
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:?\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE

3
.gitignore vendored
View File

@ -11,3 +11,6 @@ count.out
vendor/
.idea/
coverage.txt
.chglog/chglog_tmp*.md
.chglog/CHANGELOG.tpl*.md
.chglog/config.yml

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,8 @@ Descriptions for each of these will eventually be provided below.
* All patches must be provided under the Apache 2.0 License
* Please use the -S option in git to "sign off" that the commit is your work and you are providing it under the
Apache 2.0 License
* Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC.
* Submit a Github Pull Request to the appropriate branch and describe the changes sufficient.
* Please follow our naming conventions for Pull Requests.
* We will look at the patch, test it out, and give you feedback.
* Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers
from time to time but they can complicate merges and should be done separately.
@ -96,6 +97,31 @@ The basics are as follows:
5. Land when you're ready via the GitHub UI
## Convention for Pull Request Descriptions
Making unified descriptions helps a lot to generate the [CHANGELOG](./CHANGELOG.md) for the next release.
We support the style from <https://www.conventionalcommits.org>, so you can use something like this:
* type(scope): description
* i2c(PCF8583): added
* gpio(HD44780): fix wrong constants
* raspi(PWM): refactor usage
* docs(core): usage of Kernel driver
* or alternative: core(docs): usage of Kernel driver
* build(style): adjust rule for golangci-lint
We try to keep it as simple as possible:
* Do not use "fix" or "bugfix" for `type`
* Please assign "fix", "style", "refactor", "perf", "test" etc. to the related `type` (driver-type/platform-name etc.),
and start the description with e.g. "fix...", "test..." etc.
* For `type` use the name of the deepest folder (e.g. i2c/raspi/system). Feel free to order "examples" to the
related driver.
* Further values for `type` are: "docs", "build", "core"
* Please use "build" instead of "CI"
* For the `scope` use the name of the driver or feature (e.g. grove/PWM).
* If unsure don't panic, follow your feeling. Possibly the reviewer will correct it or suggest a better description.
## Developer's Certificate of Origin 1.0
By making a contribution to this project, I certify that: