Skip to content

Commit 5166941

Browse files
committed
build(release): correct creation command in Makefile
Release creation with changelog and git tag, then push to GitHub repository
1 parent 1b442c9 commit 5166941

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ commitizen uses [goreleaser](https://goreleaser.com) to release new versions fro
2020

2121
Next version is defined and changelogs is generated by [git-cliff](https://git-cliff.org/docs/installation/homebrew)
2222

23-
Commits of type fix will trigger bugfix releases, think 0.0.1 Commits of type feat will trigger feature releases, think 0.1.0 Commits with BREAKING CHANGE in body or footer will trigger breaking releases, think 1.0.0
23+
Commits of type fix will trigger bugfix releases, think 0.0.1\\ Commits of type feat will trigger feature releases, think 0.1.0\\ Commits with BREAKING CHANGE in body or footer will trigger breaking releases, think 1.0.0
24+
25+
Releases are created with git tags GitHub workflow. To create git tag for next release use command from [Makefile](Makefile)
26+
27+
```bash
28+
make version
29+
```

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ version:
3939
exit 1; \
4040
fi
4141

42-
version=$$(git cliff --bumped-version)
43-
echo "Bumping to version $$version"
44-
sed -i '' "s/const version = .*/const version = \"$$version\"/" internal/version/version.go
45-
sed -i '' "s/go install github.com\/isokolovskii\/commitizen\.*/go install github.com\/isokolovskii\/commitizen\@v$$version/" README.md
46-
git add internal/version/version.go README.md
47-
48-
git cliff --bump
42+
@version=$$(git cliff --bumped-version 2>/dev/null); \
43+
echo "Bumping to version $$version"; \
44+
sed -i '' "s/version = .*/version = \"$$version\"/" internal/version/version.go; \
45+
sed -i '' "s/go install github.com\/isokolovskii\/commitizen@.*/go install github.com\/isokolovskii\/commitizen@$$version/" README.md; \
46+
git cliff --bump -o CHANGELOG.md; \
47+
git add internal/version/version.go README.md CHANGELOG.md; \
48+
git commit -m "chore(release): $$version"; \
49+
git tag "$$version"; \
50+
git push origin $$version;

cliff.toml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ body = """
88
{% else %}\
99
## (unreleased)
1010
{% endif %}
11+
{% for group, commits in commits | group_by(attribute="group") %}
12+
### {{ group }}
1113
{% for commit in commits %}\
12-
- {{ commit.group }}: {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} by {% if commit.remote.username %}[@{{commit.remote.username}}](https://github.com/{{commit.remote.username}}) {% else %}{{ commit.author.name }}{% endif %}
14+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} by {% if commit.remote.username %}[@{{commit.remote.username}}](https://github.com/{{commit.remote.username}}) {% else %}{{ commit.author.name }}{% endif %}
15+
{% endfor %}\n
1316
{% endfor %}\n
1417
"""
1518
trim = true
16-
output = "CHANGELOG.md"
1719

1820
[git]
1921
conventional_commits = true
@@ -25,20 +27,21 @@ link_parsers = [
2527
{ pattern = "RFC(\\d+)", text = "ietf-rfc$1", href = "https://datatracker.ietf.org/doc/html/rfc$1"},
2628
]
2729
commit_parsers = [
28-
{ message = "^feat", group = "<!-- 0 -->:rocket: New features" },
29-
{ message = "^fix", group = "<!-- 1 -->:bug: Bug fixes" },
30-
{ message = "^docs", group = "<!-- 5 -->:books: Documentation" },
31-
{ message = "^perf", group = "<!-- 3 -->:zap: Performance" },
32-
{ message = "^refactor", group = "<!-- 4 -->:pencil: Refactor" },
33-
{ message = "^ci", group = "<!-- 7 -->:building_construction:ci" },
34-
{ message = "^test", group = "<!-- 6 -->:test_tube: Tests" },
35-
{ message = "^chore\\(release\\)", skip = true },
36-
{ message = "^chore", group = "<!-- 2 -->:screwdriver:chore" },
37-
{ body = ".*security", group = "<!-- 2 -->:guard: Security" },
30+
{ message = "^feat*", group = "<!-- 0 -->:rocket: New features" },
31+
{ message = "^fix*", group = "<!-- 1 -->:bug: Bug fixes" },
32+
{ message = "^docs*", group = "<!-- 5 -->:books: Documentation" },
33+
{ message = "^perf*", group = "<!-- 3 -->:zap: Performance" },
34+
{ message = "^refactor*", group = "<!-- 4 -->:pencil: Refactor" },
35+
{ message = "^ci*", group = "<!-- 7 -->:building_construction: ci" },
36+
{ message = "^test*", group = "<!-- 6 -->:test_tube: Tests" },
37+
{ message = "^chore\\(release\\)*", skip = true },
38+
{ message = "^chore*", group = "<!-- 2 -->:screwdriver:chore" },
39+
{ message = "^build*", group = "<!-- 7 -->:building_construction: ci" },
40+
{ body = ".*security.*", group = "<!-- 2 -->:guard: Security" },
3841
]
3942
protect_breaking_commits = false
4043
filter_commits = false
41-
tag_pattern = "v[0-9]*"
44+
tag_pattern = "v[0-9]*.[0-9]*.[0-9]*"
4245
skip_tags = true
4346
ignore_tags = ""
4447
topo_order = false
@@ -47,7 +50,7 @@ sort_commits = "newest"
4750
[bump]
4851
features_always_bump_minor = true
4952
breaking_always_bump_major = true
50-
initial_tag = "1.0.0"
53+
initial_tag = "v1.0.0"
5154

5255
[remote.github]
5356
owner = "isokolovskii"

0 commit comments

Comments
 (0)