Skip to content

Commit 5d5222a

Browse files
committed
feat: optional custom patterns for conventional commits
1 parent 443355d commit 5d5222a

12 files changed

+159
-5
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ The version in `pom.xml` can be automatically updated based on [conventional com
193193
<!-- Update the <version> tag //-->
194194
<updatePomWithNextSemanticVersion>true</updatePomWithNextSemanticVersion>
195195

196-
<!-- suffix version with -SNAPSHOT //-->
196+
<!-- Suffix version with -SNAPSHOT //-->
197197
<updatePomWithNextSemanticVersionSuffixSnapshot>true</updatePomWithNextSemanticVersionSuffixSnapshot>
198+
199+
<!-- Regexp patterns used to identify next version can optionally be adjusted //-->
200+
<semanticMajorVersionPattern>^[Bb]reaking</semanticMajorVersionPattern>
201+
<semanticMinorVersionPattern>[Ff]eature</semanticMinorVersionPattern>
202+
<semanticPatchVersionPattern>[Ff]ix</semanticPatchVersionPattern>
198203
</configuration>
199204
```

git-changelog-maven-plugin-example/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Changelog of git-changelog-maven-plugin.
44

5+
## 1.93.0 (2022-09-25)
6+
7+
### Features
8+
9+
- update version based on conventional commits ([9a85d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre)
10+
511
## 1.92.2 (2022-09-24)
612

713
### Bug Fixes

git-changelog-maven-plugin-example/CHANGELOG_custom.md

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ Changelog of Git Changelog Maven plugin.
44

55
## Unreleased
66
### No issue /
7+
chore: updating changelog
8+
9+
[maven-release-plugin] prepare for next development iteration
10+
11+
12+
13+
## git-changelog-maven-plugin-1.93.0
14+
### No issue /
15+
[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0
16+
17+
chore: setting version 1.93.0-SNAPSHOT
18+
19+
feat: update version based on conventional commits
20+
721
chore: build script
822

923
chore: updating changelog

git-changelog-maven-plugin-example/CHANGELOG_ignoreCommitsOlderThan.md

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ Changelog of Git Changelog Maven plugin.
44

55
## Unreleased
66
### No issue
7+
chore: updating changelog *2022-09-25 13:26:11*
8+
9+
[maven-release-plugin] prepare for next development iteration *2022-09-25 13:25:40*
10+
11+
12+
13+
## git-changelog-maven-plugin-1.93.0
14+
### No issue
15+
[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0 *2022-09-25 13:25:36*
16+
17+
chore: setting version 1.93.0-SNAPSHOT *2022-09-25 13:25:26*
18+
19+
feat: update version based on conventional commits *2022-09-25 13:24:58*
20+
721
chore: build script *2022-09-25 09:55:05*
822

923
chore: updating changelog *2022-09-24 13:38:39*

git-changelog-maven-plugin-example/CHANGELOG_inline.md

+24
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ Changelog of Git Changelog Maven plugin.
55
## Unreleased
66
### No issue
77

8+
[443355dd3420145](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/443355dd3420145) Tomas Bjerre *2022-09-25 13:26:11*
9+
10+
chore: updating changelog
11+
12+
[0f8f152636abed4](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/0f8f152636abed4) Tomas Bjerre *2022-09-25 13:25:40*
13+
14+
[maven-release-plugin] prepare for next development iteration
15+
16+
17+
## git-changelog-maven-plugin-1.93.0
18+
### No issue
19+
20+
[29dedd656a73842](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/29dedd656a73842) Tomas Bjerre *2022-09-25 13:25:36*
21+
22+
[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0
23+
24+
[2065395dcbc1fd0](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/2065395dcbc1fd0) Tomas Bjerre *2022-09-25 13:25:26*
25+
26+
chore: setting version 1.93.0-SNAPSHOT
27+
28+
[9a85dc465763deb](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre *2022-09-25 13:24:58*
29+
30+
feat: update version based on conventional commits
31+
832
[52bb4c3f9e02589](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/52bb4c3f9e02589) Tomas Bjerre *2022-09-25 09:55:05*
933

1034
chore: build script

git-changelog-maven-plugin-example/CHANGELOG_jira.md

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
Changelog of git-changelog-maven-plugin.
44

5+
## 1.93.0 (2022-09-25)
6+
7+
### Features
8+
9+
- update version based on conventional commits ([9a85d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre)
10+
11+
### Other changes
12+
13+
**[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0**
14+
15+
16+
[29ded](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/29dedd656a73842) Tomas Bjerre *2022-09-25 13:25:36*
17+
18+
**[maven-release-plugin] prepare for next development iteration**
19+
20+
21+
[9e048](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9e04872728fdca0) Tomas Bjerre *2022-09-24 13:38:02*
22+
23+
524
## 1.92.2 (2022-09-24)
625

726
### Bug Fixes

git-changelog-maven-plugin-example/CHANGELOG_minimal.md

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
Changelog of git-changelog-maven-plugin.
44

5+
## git-changelog-maven-plugin-1.93.0 (2022-09-25)
6+
7+
### Features
8+
9+
- update version based on conventional commits ([9a85d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre)
10+
11+
### Other changes
12+
13+
**[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0**
14+
15+
16+
[29ded](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/29dedd656a73842) Tomas Bjerre *2022-09-25 13:25:36*
17+
18+
**[maven-release-plugin] prepare for next development iteration**
19+
20+
21+
[9e048](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9e04872728fdca0) Tomas Bjerre *2022-09-24 13:38:02*
22+
23+
524
## git-changelog-maven-plugin-1.92.2 (2022-09-24)
625

726
### Bug Fixes

git-changelog-maven-plugin-example/CHANGELOG_mixed.md

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Changelog of Git Changelog Maven plugin.
44

55
## These commits are not included in any tag
66
### These commits have not issue in their commit comment
7+
chore: updating changelog *13:26:11*
8+
9+
10+
11+
## 1.93.0
12+
### These commits have not issue in their commit comment
13+
chore: setting version 1.93.0-SNAPSHOT *13:25:26*
14+
15+
feat: update version based on conventional commits *13:24:58*
16+
717
chore: build script *09:55:05*
818

919
chore: updating changelog *13:38:39*

git-changelog-maven-plugin-example/CHANGELOG_settings.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Changelog of git-changelog-maven-plugin.
44

55
## Next release ()
66

7+
## 1.93.0 (2022-09-25)
8+
9+
### Features
10+
11+
- update version based on conventional commits ([9a85d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre)
12+
713
## 1.92.2 (2022-09-24)
814

915
### Bug Fixes

git-changelog-maven-plugin-example/CHANGELOG_templatefile.md

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
Changelog of git-changelog-maven-plugin.
44

5+
## 1.93.0 (2022-09-25)
6+
7+
### Features
8+
9+
- update version based on conventional commits ([9a85d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9a85dc465763deb) Tomas Bjerre)
10+
11+
### Other changes
12+
13+
**[maven-release-plugin] prepare release git-changelog-maven-plugin-1.93.0**
14+
15+
16+
[29ded](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/29dedd656a73842) Tomas Bjerre *2022-09-25 13:25:36*
17+
18+
**[maven-release-plugin] prepare for next development iteration**
19+
20+
21+
[9e048](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/9e04872728fdca0) Tomas Bjerre *2022-09-24 13:38:02*
22+
23+
524
## 1.92.2 (2022-09-24)
625

726
### Bug Fixes

git-changelog-maven-plugin-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<groupId>se.bjurr.gitchangelog</groupId>
44
<artifactId>git-changelog-maven-plugin-example</artifactId>
55
<name>git-changelog-maven-plugin-example</name>
6-
<version>1.92.3-SNAPSHOT</version>
6+
<version>1.93.1-SNAPSHOT</version>
77
<properties>
88
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
99
<maven.compiler.target>1.8</maven.compiler.target>
1010
<maven.compiler.source>1.8</maven.compiler.source>
11-
<changelog.version>1.92.3-SNAPSHOT</changelog.version>
11+
<changelog.version>1.93.1-SNAPSHOT</changelog.version>
1212
</properties>
1313
<build>
1414
<plugins>

src/main/java/se/bjurr/gitchangelog/plugin/GitChangelogMojo.java

+20-2
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,30 @@ public class GitChangelogMojo extends AbstractMojo {
194194
defaultValue = "true")
195195
private boolean updatePomWithNextSemanticVersionSuffixSnapshot;
196196

197+
@Parameter(property = "semanticMajorVersionPattern", required = false)
198+
private String semanticMajorVersionPattern;
199+
200+
@Parameter(property = "semanticMinorVersionPattern", required = false)
201+
private String semanticMinorVersionPattern;
202+
203+
@Parameter(property = "semanticPatchVersionPattern", required = false)
204+
private String semanticPatchVersionPattern;
205+
197206
@Override
198207
public void execute() throws MojoExecutionException {
199208
if (this.updatePomWithNextSemanticVersion) {
200209
try {
201-
final SemanticVersion nextSemanticVersion =
202-
gitChangelogApiBuilder().getNextSemanticVersion();
210+
final GitChangelogApi gitChangelogApiBuilder = gitChangelogApiBuilder();
211+
if (this.isSupplied(this.semanticMajorVersionPattern)) {
212+
gitChangelogApiBuilder.withSemanticMajorVersionPattern(this.semanticMajorVersionPattern);
213+
}
214+
if (this.isSupplied(this.semanticMinorVersionPattern)) {
215+
gitChangelogApiBuilder.withSemanticMinorVersionPattern(this.semanticMinorVersionPattern);
216+
}
217+
if (this.isSupplied(this.semanticPatchVersionPattern)) {
218+
gitChangelogApiBuilder.withSemanticPatchVersionPattern(this.semanticPatchVersionPattern);
219+
}
220+
final SemanticVersion nextSemanticVersion = gitChangelogApiBuilder.getNextSemanticVersion();
203221
final String nextVersion =
204222
this.updatePomWithNextSemanticVersionSuffixSnapshot
205223
? nextSemanticVersion.getVersion() + "-SNAPSHOT"

0 commit comments

Comments
 (0)