Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 3.61 KB

README.md

File metadata and controls

57 lines (45 loc) · 3.61 KB

Build Status

Changelog auto generator - maven plugin

MavenAutoChangelog is a simple maven plugin which generates changelog entries from git commit messages.

It can be configured to add only such messages which meet some format;

Running

It has 2 goals:

  • generate-changelog, which will generate the initial changelog file
  • update-changelog, which will add commits happened between the last tag list in the existing changelog file and the topGitLogTag

Configuration

Maven plugin properties:

  • pathToChangelog - Path to changelog file. Default is CHANGELOG.md
  • topGitLogTag - Git tag up to which the changelog is generated. Default is HEAD
  • tagInfoLinePattern - Pattern, which is used to find the lines with tag information in existing changelog. Should have tagTitle and tagDate pattern groups. Default is "## \\[(?<tagTitle>[\\d.]+)] - (?<tagDate>[\\d]{4}-[\\d]{2}-[\\d]{2})"
  • tagInfoLineFormat - Format string for a tag line. Somewhat an opposite to tagInfoLinePattern. Should contain {{tagTitleFormat}} and {{tagDateFormat}}, which will be replaced by the values of the corresponding variables. Default is "## [{{tagTitleFormat}}] - {{tagDateFormat}}"
  • tagTitlePattern - Pattern, which tags must satisfy. Default is (.*)
  • tagTitleFormat - Somewhat opposite to tagTitlePattern. How to format tag, relatively to what is printed to changelog. Default is %s.
  • tagDateFormat - How to format tag date, when printed to the changelog file. Used in the tagInfoLineFormat variable. Default is yyyy-MM-dd.
  • applicableCommitPattern - Regexp pattern which is used to filter unwanted commits, i.e. only commits which match this regexp will be included into changelog
  • commitLineFormat - Additional java String.format(commitMessage, commitFormat) which can be used to customize changelog entry. Default is %s
  • unreleasedLinePattern - Regexp pattern which should be used to match line with 'Unreleased' token
  • mergeRequestReplacePattern - Regex pattern which is used to add merge request numbers to the messages. It must match the group which will be referenced in mergeRequestReplacement. For example (]) to add merge requests before first ] like [ABC-123] Text ==> [ABC-123 321!] Text.
  • mergeRequestReplacement - Replacement string which will be used with mergeRequestReplacePattern. Must contain token MR#, which will be replaced by merge request number. Default is " MR#$1"

Sample

For example you have a CHANGELOG.md looking like

# Change Log
## [Unreleased]

## [22.143.4] - 2022-11-11
- FIX(ALL): fix NPE

## [22.143.3] - 2022-11-09
- CONF(ALL): increase ram

Your configuration may look like:

<configuration>
  <tagTitlePattern>release/(.*)</tagTitlePattern>
  <tagTitleFormat>release/%s</tagTitleFormat>

  <tagInfoLinePattern>## \[(?&lt;tagTitle&gt;[\d.]+)] - (?&lt;tagDate&gt;[\d]{4}-[\d]{2}-[\d]{2})</tagInfoLinePattern>
  <tagInfoLineFormat>## [{{tagTitleFormat}}] - {{tagDateFormat}}</tagInfoLineFormat>

  <applicableCommitPattern>[ ]*(FIX|PFIX|FEAT|DOC|TECH|PERF|QA|CONF)[A-Z ,\(\)]*:.*</applicableCommitPattern>
  <commitLineFormat>- %s</commitLineFormat>
  <unreleasedLinePattern>## \[Unreleased.*].*</unreleasedLinePattern>
</configuration>