Skip to content

Commit de61841

Browse files
committed
build: use hatch-regex-commit to auto create git tag
1 parent f2f3ee4 commit de61841

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ repos:
4848
hooks:
4949
- id: commitlint
5050
stages: [commit-msg]
51-
additional_dependencies: ["@commitlint/config-angular"]
51+
# NOTE: the dependencies must consistent with `commitlint.config.js`
52+
additional_dependencies: ["@commitlint/config-conventional"]

commitlint.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
// https://commitlint.js.org/#/reference-configuration?id=shareable-configuration
1+
// refer to: https://commitlint.js.org/#/reference-configuration?id=shareable-configuration
22
// Rule: https://karma-runner.github.io/6.4/dev/git-commit-msg.html
3-
module.exports = { extends: ['@commitlint/config-angular'] };
3+
// Rule: https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional
4+
5+
// NOTE: the extends must consistent with `.pre-commit-config.yaml`
6+
module.exports = { extends: ['@commitlint/config-conventional'] };

pyproject.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling >= 1.13.0"]
2+
requires = ["hatchling >= 1.13.0", "hatch-regex-commit"]
33
build-backend = "hatchling.build"
44

55
# https://hatch.pypa.io/latest/config/metadata/
@@ -59,7 +59,16 @@ Documentation = "https://WSH032.github.io/fastapi-proxy-lib/"
5959

6060

6161
[tool.hatch.version]
62+
# refer to: https://github.com/frankie567/hatch-regex-commit
63+
source = "regex_commit"
64+
commit_extra_args = ["-e"]
6265
path = "src/fastapi_proxy_lib/__init__.py"
66+
# NOTE: `chore` is required by commitlint
67+
commit_message = "chore(version): 🚀 bump version {current_version} → {new_version}"
68+
tag_message = "🚀 bump version {current_version} → {new_version}"
69+
# NOTE: `v` prefix is required by github `publish.yml` action
70+
tag_name = "v{new_version}"
71+
6372

6473
[tool.hatch.envs.default]
6574
path = ".venv" # for vscode auto selecting python interpreter

0 commit comments

Comments
 (0)