|
| 1 | +# Bump |
| 2 | + |
| 3 | +The version is bumped automatically based on the commits. |
| 4 | + |
| 5 | +The commits should follow the rules of the commiter in order to be parsed properly. |
| 6 | + |
| 7 | +The version can also be manually bumped. |
| 8 | + |
| 9 | +The version format follows **semantic versioning**. |
| 10 | + |
| 11 | +This means: |
| 12 | + |
| 13 | +| Increment | Description | Conventional commit map | |
| 14 | +| ------- | ----- | ------ | |
| 15 | +| `MAJOR` | Breaking changes introduced | `BREAKING CHANGE` | |
| 16 | +| `MINOR` | New features | `feat` | |
| 17 | +| `PATCH` | Fixes | `fix` + everything else | |
| 18 | + |
| 19 | + |
| 20 | +Also to support some extra functionality like prereleases, |
| 21 | +python's [PEP 0440][pep440] is followed. |
| 22 | + |
| 23 | +The scheme of this format is |
| 24 | + |
| 25 | +``` |
| 26 | +[N!]N(.N)*[{a|b|rc}N][.postN][.devN] |
| 27 | +``` |
| 28 | + |
| 29 | +Some examples: |
| 30 | + |
| 31 | +``` |
| 32 | +0.9.0 |
| 33 | +0.9.1 |
| 34 | +0.9.2 |
| 35 | +0.9.10 |
| 36 | +0.9.11 |
| 37 | +1.0.0a0 # alpha |
| 38 | +1.0.0a1 |
| 39 | +1.0.0b0 # beta |
| 40 | +1.0.0rc0 # release candidate |
| 41 | +1.0.0rc1 |
| 42 | +1.0.0 |
| 43 | +1.0.1 |
| 44 | +1.1.0 |
| 45 | +2.0.0 |
| 46 | +2.0.1a |
| 47 | +``` |
| 48 | + |
| 49 | +`post` and `dev` releases are not yet supported. |
| 50 | + |
| 51 | +## Configuration |
| 52 | + |
| 53 | +`tag_format` |
| 54 | + |
| 55 | +Used to read the format from the git tags, and also to generate the tags. |
| 56 | + |
| 57 | +Supports 2 types of formats, a simple and a more complex. |
| 58 | + |
| 59 | +```bash |
| 60 | +cz bump --tag_format="v$version" |
| 61 | +``` |
| 62 | + |
| 63 | +```bash |
| 64 | +cz bump --tag_format="v$minor.$major.$path$prerelease" |
| 65 | +``` |
| 66 | + |
| 67 | +In your `pyproject.toml` |
| 68 | + |
| 69 | +```toml |
| 70 | +[commitizen] |
| 71 | +tag_format = "v$minor.$major.$path$prerelease" |
| 72 | +``` |
| 73 | + |
| 74 | +The variables must be preceded by a `$` sign. |
| 75 | + |
| 76 | +Suppported variables: |
| 77 | + |
| 78 | +| Var | Description | |
| 79 | +| --- | ----------- | |
| 80 | +| `$version` | full generated version | |
| 81 | +| `$major` | MAJOR increment | |
| 82 | +| `$minor` | MINOR increment | |
| 83 | +| `$patch` | PATCH increment | |
| 84 | +| `$prerelease` | Prerelase (alpha, beta, release candidate) | |
| 85 | + |
| 86 | +`files` |
| 87 | + |
| 88 | +Used to identify the files which should be updated with the new version. |
| 89 | +In your `pyproject.toml` |
| 90 | + |
| 91 | +Commitizen will update it's configuration (`pyproject.toml`, `.cz`) when bumping. |
| 92 | + |
| 93 | +```toml |
| 94 | +[commitizen] |
| 95 | +files = [ |
| 96 | + "src/__version__.py", |
| 97 | + "setup.py" |
| 98 | +] |
| 99 | +``` |
| 100 | + |
| 101 | +[pep440]: https://www.python.org/dev/peps/pep-0440/ |
0 commit comments