Skip to content

Commit 516fd42

Browse files
chore(DVIZ-24): add release config to the workflow configuration
1 parent 5a8ecad commit 516fd42

File tree

2 files changed

+102
-26
lines changed

2 files changed

+102
-26
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,25 @@ jobs:
4444
git config user.email "tmugo@developmentgateway.org"
4545
git config user.name "Timothy Mugo Gachengo"
4646
47-
- name: Prepare Release
48-
id: release
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Build the Maven project
5148
run: |
52-
# Get current version from pom.xml
53-
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
54-
echo "Current version: $CURRENT_VERSION"
55-
56-
# Remove -SNAPSHOT and calculate next version
57-
VERSION=${CURRENT_VERSION%-SNAPSHOT}
58-
IFS='.' read -r major minor patch <<< "$VERSION"
59-
NEXT_VERSION="$major.$minor.$((patch + 1))-SNAPSHOT"
60-
61-
# Perform release
62-
mvn -B release:prepare release:perform \
63-
-DreleaseVersion=$VERSION \
64-
-DdevelopmentVersion=$NEXT_VERSION \
65-
-DtagNameFormat=v@{project.version} \
66-
-DpushChanges=true \
67-
-DlocalCheckout=true \
68-
-DpreparationGoals="clean verify -Dcheckstyle.skip -DskipTests" \
69-
-DcompletionGoals="verify -Dcheckstyle.skip -DskipTests" \
70-
-Darguments="-DskipTests -Dcheckstyle.skip"
71-
72-
echo "version=$VERSION" >> $GITHUB_OUTPUT
73-
echo "Released version $VERSION"
49+
mvn package -DskipTests=true -Dcheckstyle.skip \
50+
&& mkdir -p forms/target/deps \
51+
&& cd forms/target/deps \
52+
&& jar -xf ../*.jar
53+
54+
- name: Generate Tag
55+
uses: mathieudutour/github-tag-action@v6.2
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
58+
release_branches: 'master,main,release/*'
59+
60+
- uses: ncipollo/release-action@v1
61+
with:
62+
tag: ${{ steps.tag_version.outputs.new_tag }}
63+
name: Release ${{ steps.tag_version.outputs.new_tag }}
64+
body: ${{ steps.tag_version.outputs.changelog }}
65+
artifacts: forms/target/*.jar
7466

7567
build-and-push-docker-image:
7668
needs: release-and-tag

cliff.toml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# template for the changelog header
6+
header = """
7+
# Changelog\n
8+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
9+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
10+
"""
11+
# template for the changelog body
12+
# https://keats.github.io/tera/docs/#introduction
13+
body = """
14+
{%- macro remote_url() -%}
15+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
16+
{%- endmacro -%}
17+
18+
{% if version -%}
19+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
20+
{% else -%}
21+
## [Unreleased]
22+
{% endif -%}
23+
24+
{% for group, commits in commits | group_by(attribute="group") %}
25+
### {{ group | upper_first }}
26+
{%- for commit in commits %}
27+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
28+
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
29+
{% if commit.remote.pr_number %} in \
30+
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
31+
{%- endif -%}
32+
{% endfor %}
33+
{% endfor %}
34+
35+
{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
36+
## New Contributors
37+
{%- endif -%}
38+
39+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
40+
* @{{ contributor.username }} made their first contribution
41+
{%- if contributor.pr_number %} in \
42+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
43+
{%- endif %}
44+
{%- endfor %}\n
45+
"""
46+
# template for the changelog footer
47+
footer = """
48+
\n
49+
Developed by Development Gateway
50+
"""
51+
# remove the leading and trailing whitespace from the templates
52+
trim = true
53+
54+
[git]
55+
# parse the commits based on https://www.conventionalcommits.org
56+
conventional_commits = true
57+
# filter out the commits that are not conventional
58+
filter_unconventional = false
59+
# regex for preprocessing the commit messages
60+
commit_preprocessors = [
61+
# remove issue numbers from commits
62+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
63+
]
64+
# regex for parsing and grouping commits
65+
commit_parsers = [
66+
{ message = "^[a|A]dd", group = "Added" },
67+
{ message = "^[s|S]upport", group = "Added" },
68+
{ message = "^[r|R]emove", group = "Removed" },
69+
{ message = "^.*: add", group = "Added" },
70+
{ message = "^.*: support", group = "Added" },
71+
{ message = "^.*: remove", group = "Removed" },
72+
{ message = "^.*: delete", group = "Removed" },
73+
{ message = "^test", group = "Fixed" },
74+
{ message = "^fix", group = "Fixed" },
75+
{ message = "^.*: fix", group = "Fixed" },
76+
{ message = "^.*", group = "Changed" },
77+
78+
]
79+
# filter out the commits that are not matched by commit parsers
80+
filter_commits = false
81+
# sort the tags topologically
82+
topo_order = false
83+
# sort the commits inside sections by oldest/newest order
84+
sort_commits = "newest"

0 commit comments

Comments
 (0)