Skip to content

Commit 1a46fd6

Browse files
committed
Update release and changelog scripts
1 parent f757236 commit 1a46fd6

File tree

10 files changed

+58
-61
lines changed

10 files changed

+58
-61
lines changed

.github/workflows/release.yml renamed to .github/workflows/github-release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ jobs:
99
steps:
1010
- name: Checkout repository
1111
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Generate changelog
15+
uses: orhun/git-cliff-action@v2
16+
with:
17+
args: -vv --latest --strip all
1218
- name: Create release
13-
run: gh release create ${{ github.ref_name}} -F CHANGELOG.md
19+
run: gh release create ${{ github.ref_name}} -F git-cliff/CHANGELOG.md
1420
env:
1521
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ mvn clean install
2020
mvn -q -pl examples exec:java -Dexec.mainClass=dev.andstuff.kraken.example.Examples
2121
```
2222

23-
24-
[1]: https://www.kraken.com/en-us/help/api
23+
[1]: https://docs.kraken.com/rest/

changelog.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

cliff.toml

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,41 @@
1-
# git-cliff ~ default configuration file
1+
# git-cliff configuration file
22
# https://git-cliff.org/docs/configuration
3-
#
4-
# Lines starting with "#" are comments.
5-
# Configuration options are organized into tables and keys.
6-
# See documentation for more information on available options.
7-
83

94
[changelog]
105

11-
# changelog header
126
header = """
13-
# Changelog\n
14-
All notable changes to this project will be documented in this file.\n
7+
# Changelog\n\n
158
"""
169

17-
# template for the changelog body
18-
# https://keats.github.io/tera/docs/#introduction
1910
body = """
2011
{% if version %}\
21-
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
12+
{% if previous.version %}\
13+
## [{{ version | trim_start_matches(pat="v") }}](<REPO>/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
14+
{% else %}\
15+
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
16+
{% endif %}\
2217
{% else %}\
2318
## [unreleased]
2419
{% endif %}\
2520
{% for group, commits in commits | group_by(attribute="group") %}
26-
### {{ group | upper_first }}
21+
### {{ group | striptags | trim }}
2722
{% for commit in commits %}
28-
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
23+
- [`{{ commit.id | truncate(length=7, end="") }}`](<REPO>/commit/{{ commit.id }}) \
24+
{% if commit.scope %}*({{ commit.scope }})* {% endif %}\
25+
{% if commit.breaking %}**[breaking]** {% endif %}\
26+
{{ commit.message | split(pat="\n") | first | upper_first | trim }}\
2927
{% endfor %}
3028
{% endfor %}\n
3129
"""
3230

33-
# template for the changelog footer
34-
footer = """
35-
<!-- generated by git-cliff -->
36-
"""
31+
footer = "<!-- generated by git-cliff -->"
3732

38-
# remove the leading and trailing s
33+
# remove the leading and trailing whitespace from the templates
3934
trim = true
4035

4136
# postprocessors
4237
postprocessors = [
43-
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
38+
{ pattern = '<REPO>', replace = "https://github.com/nyg/kraken-api-java" }
4439
]
4540

4641

@@ -58,29 +53,24 @@ split_commits = false
5853
# regex for preprocessing the commit messages
5954
commit_preprocessors = [
6055
# Replace issue numbers
61-
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
62-
# Check spelling of the commit with https://github.com/crate-ci/typos
63-
# If the spelling is incorrect, it will be automatically fixed.
64-
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
56+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
57+
{ pattern = ' #([0-9]+) ', replace = " [#${1}](<REPO>/issues/${1}) " }
6558
]
6659

6760
# regex for parsing and grouping commits
6861
commit_parsers = [
69-
{ message = "^feat", group = "Features" },
70-
{ message = "^fix", group = "Bug Fixes" },
71-
{ message = "^doc", group = "Documentation" },
72-
{ message = "^perf", group = "Performance" },
73-
{ message = "^refactor", group = "Refactor" },
74-
{ message = "^style", group = "Styling" },
75-
{ message = "^test", group = "Testing" },
76-
{ message = "^chore\\(release\\): prepare for", skip = true },
77-
{ message = "^chore\\(deps\\)", skip = true },
78-
{ message = "^chore\\(pr\\)", skip = true },
79-
{ message = "^chore\\(pull\\)", skip = true },
80-
{ message = "^(chore|ci)", group = "Miscellaneous Tasks" },
81-
{ message = "^revert", group = "Revert" },
82-
{ message = "^\\[maven-release-plugin\\]", skip = true },
83-
{ message = ".*", group = "Other" },
62+
{ message = "^security", group = "<!-- 0 -->🛡️ Security" },
63+
{ message = "^feat", group = "<!-- 1 -->⛰️ Features" },
64+
{ message = "^fix", group = "<!-- 2 -->🐛 Bug Fixes" },
65+
{ message = "^refactor", group = "<!-- 3 -->🚜 Refactor" },
66+
{ message = "^doc", group = "<!-- 4 -->📚 Documentation" },
67+
{ message = "^perf", group = "<!-- 5 -->⚡ Performance" },
68+
{ message = "^style", group = "<!-- 6 -->🎨 Styling" },
69+
{ message = "^test", group = "<!-- 7 -->🧪 Testing" },
70+
{ message = "^chore\\(release\\):", skip = true },
71+
{ message = "^(chore|ci|build)", group = "<!-- 8 -->⚙️ Miscellaneous" },
72+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
73+
{ message = ".*", group = "Others" },
8474
]
8575

8676
# protect breaking changes from being skipped due to matching a skipping commit_parser

examples/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
43

54
<modelVersion>4.0.0</modelVersion>
65

library/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
43

54
<modelVersion>4.0.0</modelVersion>
65

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
43

54
<modelVersion>4.0.0</modelVersion>
65

@@ -85,7 +84,7 @@
8584
<artifactId>exec-maven-plugin</artifactId>
8685
<version>${exec-maven-plugin.version}</version>
8786
<configuration>
88-
<executable>./changelog.sh</executable>
87+
<executable>./scripts/generate-changelog.sh</executable>
8988
</configuration>
9089
</plugin>
9190
<plugin>
@@ -95,10 +94,10 @@
9594
<configuration>
9695
<!-- release:prepare -->
9796
<autoVersionSubmodules>true</autoVersionSubmodules>
98-
<tagNameFormat>v@{version}</tagNameFormat>
99-
<signTag>true</signTag>
10097
<preparationGoals>clean verify exec:exec</preparationGoals>
101-
<pushChanges>false</pushChanges>
98+
<scmCommentPrefix>chore(release):&#32;</scmCommentPrefix>
99+
<signTag>true</signTag>
100+
<tagNameFormat>v@{version}</tagNameFormat>
102101
<!-- release:perform -->
103102
<releaseProfiles>maven-central</releaseProfiles>
104103
</configuration>

release.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

scripts/create-release.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mvn -Dtag=v1.0.0 -DreleaseVersion=1.0.0 -DdevelopmentVersion=1.0.1-SNAPSHOT release:prepare release:perform
2+
git fetch

scripts/generate-changelog.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env sh
2+
3+
CURRENT_DIR=$(basename $PWD)
4+
5+
if [ "$CURRENT_DIR" = "kraken-api-java" ]
6+
then
7+
VERSION=$(grep scm.tag= release.properties | awk -Fv '{print $2}')
8+
echo Generating changelog for version $VERSION
9+
10+
git cliff -o CHANGELOG.md --tag $VERSION
11+
git add CHANGELOG.md
12+
fi

0 commit comments

Comments
 (0)