Skip to content

Commit d540091

Browse files
committed
feat: support conventional commits
1 parent b22f0da commit d540091

16 files changed

+417
-166
lines changed

CHANGELOG.md

+35-17
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,26 @@
22

33
Changelog of Git Changelog Maven plugin.
44

5+
## Unreleased
6+
### GitHub #31
7+
8+
**Merge pull request #31 from edeso/simplePlainTextExample**
9+
10+
* Add unescaped simple plain text example
11+
12+
[b22f0da746acfa7](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/b22f0da746acfa7) Tomas Bjerre *2021-05-25 14:07:41*
13+
14+
15+
### No issue
16+
17+
**Add unescaped simple plain text example**
18+
19+
20+
[7f8db986669cdb9](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/7f8db986669cdb9) ed *2021-05-25 13:57:25*
21+
22+
523
## 1.69
6-
### GitHub [#27](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/27) Support custom headers to JIRA to bypass 2 factor auth
24+
### GitHub #27
725

826
**Merge pull request #27 from drhip/feature/extended_headers**
927

@@ -49,7 +67,7 @@ Changelog of Git Changelog Maven plugin.
4967

5068

5169
## 1.65
52-
### GitHub [#24](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/24) Passing extendedVariables Property using mvn -D Commandline Option
70+
### GitHub #24
5371

5472
**More logging of extended variables from CLI #24**
5573

@@ -68,7 +86,7 @@ Changelog of Git Changelog Maven plugin.
6886

6987

7088
## 1.64
71-
### GitHub [#21](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/21) Goal not marked as Thread-safe
89+
### GitHub #21
7290

7391
**Mark as thread safe #21**
7492

@@ -77,7 +95,7 @@ Changelog of Git Changelog Maven plugin.
7795

7896

7997
## 1.63
80-
### GitHub [#19](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/19) Add support for pathfilter
98+
### GitHub #19
8199

82100
**Adjustments after merge of PR #19**
83101

@@ -100,7 +118,7 @@ Changelog of Git Changelog Maven plugin.
100118

101119

102120
## 1.62
103-
### GitHub [#18](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/18) Add extendedVariables property
121+
### GitHub #18
104122

105123
**Merge pull request #18 from djn72/master**
106124

@@ -123,7 +141,7 @@ Changelog of Git Changelog Maven plugin.
123141

124142

125143
## 1.61
126-
### GitHub [#12](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/12) Add a skip configration option
144+
### GitHub #12
127145

128146
**Adding skip option #12**
129147

@@ -205,7 +223,7 @@ Changelog of Git Changelog Maven plugin.
205223

206224

207225
## 1.55
208-
### GitHub [#10](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/10) docs: Updates README.md to improve readability
226+
### GitHub #10
209227

210228
**Merge pull request #10 from lennonjesus/patch-1**
211229

@@ -287,7 +305,7 @@ Changelog of Git Changelog Maven plugin.
287305

288306

289307
## 1.50
290-
### GitHub [#9](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/9) Issue when using removeIssueFromMessage and settingFile
308+
### GitHub #9
291309

292310
**Defaulting ignoreCommitsWithoutIssue #9**
293311

@@ -451,7 +469,7 @@ Changelog of Git Changelog Maven plugin.
451469

452470

453471
## 1.39
454-
### GitHub [#7](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/7) Fix fromCommit and fromRef property typo
472+
### GitHub #7
455473

456474
**Merge pull request #7 from dunse/patch-1**
457475

@@ -739,7 +757,7 @@ Changelog of Git Changelog Maven plugin.
739757

740758

741759
## 1.20
742-
### GitHub [#6](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/6) GitHub OAuth2 Token support
760+
### GitHub #6
743761

744762
**Support GitHub OAuth2 tokens #6**
745763

@@ -837,7 +855,7 @@ Changelog of Git Changelog Maven plugin.
837855

838856

839857
## 1.14
840-
### GitHub [#5](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/5) One line git commit messege
858+
### GitHub #5
841859

842860
**Added variables: messageTitle, messageBody, messageItems #5**
843861

@@ -882,7 +900,7 @@ Changelog of Git Changelog Maven plugin.
882900

883901

884902
## 1.12
885-
### GitHub [#4](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/4) The tags are out of order
903+
### GitHub #4
886904

887905
**Using lib 1.23 to sort commits by time, not formatted time #4**
888906

@@ -904,7 +922,7 @@ Changelog of Git Changelog Maven plugin.
904922

905923

906924
## 1.11
907-
### GitHub [#3](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/3) Enhance documentation for changelog.json file
925+
### GitHub #3
908926

909927
**Documentation and more configuration available in pom #3**
910928

@@ -931,7 +949,7 @@ Changelog of Git Changelog Maven plugin.
931949

932950

933951
## 1.10
934-
### GitHub [#2](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/2) Allow for template to be added directly in pom.xml
952+
### GitHub #2
935953

936954
**Template can be configured directly in the pom #2**
937955

@@ -948,7 +966,7 @@ Changelog of Git Changelog Maven plugin.
948966

949967

950968
## 1.9
951-
### GitHub [#1](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/1) Update to lates lib version
969+
### GitHub #1
952970

953971
**Using lib 1.17 #1**
954972

@@ -965,7 +983,7 @@ Changelog of Git Changelog Maven plugin.
965983

966984

967985
## 1.8
968-
### GitHub [#1](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/1) Update to lates lib version
986+
### GitHub #1
969987

970988
**Using lib 1.15 #1**
971989

@@ -1002,7 +1020,7 @@ Changelog of Git Changelog Maven plugin.
10021020

10031021

10041022
## 1.5
1005-
### GitHub [#1](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/1) Update to lates lib version
1023+
### GitHub #1
10061024

10071025
**Using lib 1.12 #1**
10081026

README.md

+110-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Git Changelog Maven Plugin
2+
23
[![Build Status](https://travis-ci.org/tomasbjerre/git-changelog-maven-plugin.svg?branch=master)](https://travis-ci.org/tomasbjerre/git-changelog-maven-plugin)
34
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/se.bjurr.gitchangelog/git-changelog-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/se.bjurr.gitchangelog/git-changelog-maven-plugin)
45

56
This is a Maven plugin for [Git Changelog Lib](https://github.com/tomasbjerre/git-changelog-lib).
67

7-
## Usage ##
8+
## Usage
9+
810
There is a running example [here](https://github.com/tomasbjerre/git-changelog-maven-plugin/tree/master/git-changelog-maven-plugin-example).
911

1012
Have a look at the [pom.xml](https://github.com/tomasbjerre/git-changelog-maven-plugin/blob/master/git-changelog-maven-plugin-example/pom.xml) where you will find some more examples.
@@ -28,9 +30,20 @@ Here is and example that will generate a CHANGELOG.md when running `mvn generate
2830
<configuration>
2931
<templateContent>
3032
<![CDATA[
31-
# Changelog
32-
Changelog of My Project.
33+
Template here!
34+
]]>
35+
</templateContent>
36+
</configuration>
37+
</execution>
38+
</executions>
39+
</plugin>
40+
</plugins>
41+
</build>
42+
```
43+
44+
### Template - Simple
3345

46+
```hbs
3447
{{#tags}}
3548
## {{name}}
3649
{{#issues}}
@@ -50,7 +63,7 @@ Changelog of My Project.
5063
**{{{messageTitle}}}**
5164
5265
{{#messageBodyItems}}
53-
* {{.}}
66+
* {{.}}
5467
{{/messageBodyItems}}
5568
5669
[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*
@@ -59,8 +72,99 @@ Changelog of My Project.
5972
6073
{{/issues}}
6174
{{/tags}}
62-
]]>
63-
</templateContent>
75+
```
76+
77+
### Template - Semantic versioning from conventional commits
78+
79+
If you are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/):
80+
81+
```shell
82+
<type>[optional scope]: <description>
83+
84+
[optional body]
85+
86+
[optional footer(s)]
87+
```
88+
89+
A changelog can be rendered (using [Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers)) like this:
90+
91+
```hbs
92+
# Changelog
93+
94+
{{#tags}}
95+
{{#ifReleaseTag .}}
96+
## [{{name}}](https://gitservice/{{name}}) ({{tagDate .}})
97+
98+
{{#ifContainsType commits type='feat'}}
99+
### Features
100+
101+
{{#commits}}
102+
{{#ifCommitType . type='feat'}}
103+
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
104+
{{/ifCommitType}}
105+
{{/commits}}
106+
{{/ifContainsType}}
107+
108+
{{#ifContainsType commits type='fix'}}
109+
### Bug Fixes
110+
111+
{{#commits}}
112+
{{#ifCommitType . type='fix'}}
113+
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
114+
{{/ifCommitType}}
115+
{{/commits}}
116+
{{/ifContainsType}}
117+
118+
{{/ifReleaseTag}}
119+
{{/tags}}
120+
```
121+
122+
### Example - custom helpers
123+
124+
You can add your own helpers and use them in the template. There are also [built in Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers).
125+
126+
```xml
127+
<build>
128+
<plugins>
129+
<plugin>
130+
<groupId>se.bjurr.gitchangelog</groupId>
131+
<artifactId>git-changelog-maven-plugin</artifactId>
132+
<version>${changelog}</version>
133+
<executions>
134+
<execution>
135+
<id>GenerateGitChangelog</id>
136+
<phase>generate-sources</phase>
137+
<goals>
138+
<goal>git-changelog</goal>
139+
</goals>
140+
<configuration>
141+
<javascriptHelper>
142+
<![CDATA[
143+
Handlebars.registerHelper('startsWith', function(messageTitle, options) {
144+
const s = options.hash['s']
145+
if (new RegExp('^' + s + '.*').test(messageTitle)) {
146+
return options.fn(this);
147+
} else {
148+
return options.inverse(this);
149+
}
150+
});
151+
152+
Handlebars.registerHelper('firstLetters', function(from, options) {
153+
const num = parseInt(options.hash['number'])
154+
return from.substring(0,num)
155+
});
156+
]]>
157+
</javascriptHelper>
158+
<templateContent>
159+
<![CDATA[
160+
{{#commits}}
161+
{{#startsWith messageTitle s='Removing'}}
162+
Starts with Removing: "{{messageTitle}}"
163+
first 10 letters of hash is: {{firstLetters hash number='10'}}
164+
{{/startsWith}}
165+
{{/commits}}
166+
]]>
167+
</templateContent>
64168
</configuration>
65169
</execution>
66170
</executions>

0 commit comments

Comments
 (0)