Skip to content

Commit 7348e8e

Browse files
committed
docs: add info about extra pattern in the files when bumping
1 parent aa89003 commit 7348e8e

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

docs/bump.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
![Bump version](images/bump.gif)
32

43
## About
@@ -15,11 +14,11 @@ The version format follows [semantic versioning][semver].
1514

1615
This means `MAJOR.MINOR.PATCH`
1716

18-
| Increment | Description | Conventional commit map |
19-
| ------- | ----- | ------ |
20-
| `MAJOR` | Breaking changes introduced | `BREAKING CHANGE` |
21-
| `MINOR` | New features | `feat` |
22-
| `PATCH` | Fixes | `fix` + everything else |
17+
| Increment | Description | Conventional commit map |
18+
| --------- | --------------------------- | ----------------------- |
19+
| `MAJOR` | Breaking changes introduced | `BREAKING CHANGE` |
20+
| `MINOR` | New features | `feat` |
21+
| `PATCH` | Fixes | `fix` + everything else |
2322

2423
Prereleases are supported following python's [PEP 0440][pep440]
2524

@@ -71,10 +70,9 @@ optional arguments:
7170
manually specify the desired increment
7271
```
7372

74-
7573
## Configuration
7674

77-
`tag_format`
75+
### `tag_format`
7876

7977
Used to read the format from the git tags, and also to generate the tags.
8078

@@ -90,7 +88,6 @@ cz bump --tag_format="v$minor.$major.$path$prerelease"
9088

9189
In your `pyproject.toml`
9290

93-
9491
[tool.commitizen]
9592
tag_format = "v$minor.$major.$path$prerelease"
9693

@@ -103,20 +100,23 @@ The variables must be preceded by a `$` sign.
103100

104101
Suppported variables:
105102

106-
| Variable | Description |
107-
| --- | ----------- |
108-
| `$version` | full generated version |
109-
| `$major` | MAJOR increment |
110-
| `$minor` | MINOR increment |
111-
| `$patch` | PATCH increment |
103+
| Variable | Description |
104+
| ------------- | ------------------------------------------ |
105+
| `$version` | full generated version |
106+
| `$major` | MAJOR increment |
107+
| `$minor` | MINOR increment |
108+
| `$patch` | PATCH increment |
112109
| `$prerelease` | Prerelase (alpha, beta, release candidate) |
113110

114-
`files`
111+
---
112+
113+
### `files`
115114

116115
Used to identify the files which should be updated with the new version.
117-
In your `pyproject.toml`
116+
It is also possible to provide a pattern for each file, separated by colons (`:`).
118117

119-
Commitizen will update it's configuration (`pyproject.toml`, `.cz`) when bumping.
118+
Commitizen will update it's configuration file automatically (`pyproject.toml`, `.cz`) when bumping,
119+
regarding if the file is present or not in `files`.
120120

121121
Some examples
122122

@@ -125,30 +125,33 @@ Some examples
125125
[tool.commitizen]
126126
files = [
127127
"src/__version__.py",
128-
"setup.py"
128+
"setup.py:version"
129129
]
130130

131-
132131
`.cz`
133132

134133
[commitizen]
135134
files = [
136135
"src/__version__.py",
137-
"setup.py"
136+
"setup.py:version"
138137
]
139138

140-
`bump_message`
139+
In the example above, we can see the reference `"setup.py:version"`.
140+
This means that it will find a file `setup.py` and will only make a change
141+
in a line containing the `version` substring.
141142

142-
Template used to specify the commit message generated when bumping
143+
---
143144

144-
defaults to: `bump: version $current_version → $new_version`
145+
### `bump_message`
145146

147+
Template used to specify the commit message generated when bumping
146148

149+
defaults to: `bump: version $current_version → $new_version`
147150

148-
| Variable | Description |
149-
| --- | ----------- |
151+
| Variable | Description |
152+
| ------------------ | ----------------------------------- |
150153
| `$current_version` | the version existing before bumping |
151-
| `$new_version` | version generated after bumping |
154+
| `$new_version` | version generated after bumping |
152155

153156
Some examples
154157

@@ -162,7 +165,6 @@ Some examples
162165
[commitizen]
163166
bump_message = release $current_version → $new_version [skip-ci]
164167

165-
166168
## Custom bump
167169

168170
Read the [customizing section](./customization.md).

docs/config.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
# Configuration
22

3-
**New!** Support for `pyproject.toml`
3+
Commitizen has support for `toml` and `ini` files.
44

5-
Add an entry to `pyproject.toml`.
5+
## pyproject.toml
66

7+
Add an entry to `pyproject.toml`. Recommended for **python** projects.
78

89
[tool.commitizen]
910
name = "cz_conventional_commits"
1011
version = "0.1.0"
1112
files = [
1213
"src/__version__.py",
13-
"pyproject.toml"
14+
"pyproject.toml:version"
1415
]
1516

17+
## INI files
1618

17-
Also, you can create in your project folder a file called `.cz`,
18-
`.cz.cfg` or in your `setup.cfg` or if you want to configure the global
19-
default in your user's home folder a `.cz` file with the following
20-
information:
19+
Supported files: `.cz`, `.cz.cfg`, `setup.py`, and `$HOME/.cz`
20+
21+
The format is slightly different to the `toml`, so pay attention.
22+
Recommended for **other languages** projects (js, go, etc).
2123

2224
[commitizen]
2325
name = cz_conventional_commits
2426
version = 0.1.0
2527
files = [
2628
"src/__version__.py",
27-
"pyproject.toml"
29+
"pyproject.toml:version"
2830
]
2931

30-
The extra tab at the end (`]`) is required.
32+
The extra tab before the square brakets (`]`) at the end is required.
3133

3234
## Settings
3335

3436
| Variable | Type | Default | Description |
3537
| -------- | ---- | ------- | ----------- |
3638
| `name` | `str` | `"cz_conventional_commits"` | Name of the commiting rules to use |
3739
| `version` | `str` | `None` | Current version. Example: "0.1.2" |
38-
| `files` | `list` | `[ ]` | Files were the version needs to be updated |
39-
| `tag_format` | `str` | `None` | Format for the git tag, useful for old projects, that use a convention like `"v1.2.1"`. [See more](/bump#configuration) |
40-
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more](/bump#configuration) |
40+
| `files` | `list` | `[ ]` | Files were the version will be updated. A pattern to match a line, can also be specified, separated by `:` [See more](https://woile.github.io/commitizen/bump#files) |
41+
| `tag_format` | `str` | `None` | Format for the git tag, useful for old projects, that use a convention like `"v1.2.1"`. [See more](https://woile.github.io/commitizen/bump#tag_format) |
42+
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more](https://woile.github.io/commitizen/bump#bump_message) |

0 commit comments

Comments
 (0)