-
-
Notifications
You must be signed in to change notification settings - Fork 281
fix(#271): add annotated_tag option to bump #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,13 @@ def __init__(self, config: BaseConfig, arguments: dict): | |
**config.settings, | ||
**{ | ||
key: arguments[key] | ||
for key in ["tag_format", "prerelease", "increment", "bump_message"] | ||
for key in [ | ||
"tag_format", | ||
"prerelease", | ||
"increment", | ||
"bump_message", | ||
"annotated_tag", | ||
] | ||
if arguments[key] is not None | ||
}, | ||
} | ||
|
@@ -157,7 +163,11 @@ def __call__(self): # noqa: C901 | |
c = git.commit(message, args=self._get_commit_args()) | ||
if c.return_code != 0: | ||
raise BumpCommitFailedError(f'git.commit error: "{c.err.strip()}"') | ||
c = git.tag(new_tag_version) | ||
c = git.tag( | ||
new_tag_version, | ||
annotated=self.bump_settings.get("annotated_tag", False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to enhance readbility, I would suggest make |
||
or bool(self.config.settings.get("annotated_tag", False)), | ||
) | ||
if c.return_code != 0: | ||
raise BumpTagFailedError(c.err) | ||
out.success("Done!") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,32 +54,30 @@ Some examples: | |
|
||
```bash | ||
$ cz bump --help | ||
usage: cz bump [-h] [--dry-run] [--files-only] [--changelog] [--no-verify] | ||
[--yes] [--tag-format TAG_FORMAT] [--bump-message BUMP_MESSAGE] | ||
[--prerelease {alpha,beta,rc}] | ||
[--increment {MAJOR,MINOR,PATCH}] [--check-consistency] | ||
usage: cz bump [-h] [--dry-run] [--files-only] [--changelog] [--no-verify] [--yes] | ||
[--tag-format TAG_FORMAT] [--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}] | ||
[--increment {MAJOR,MINOR,PATCH}] [--check-consistency] [--annotated-tag] | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
--dry-run show output to stdout, no commit, no modified files | ||
--files-only bump version in the files from the config | ||
--changelog, -ch generate the changelog for the newest version | ||
--no-verify this option bypasses the pre-commit and commit-msg | ||
hooks | ||
--no-verify this option bypasses the pre-commit and commit-msg hooks | ||
--yes accept automatically questions done | ||
--tag-format TAG_FORMAT | ||
the format used to tag the commit and read it, use it | ||
in existing projects, wrap around simple quotes | ||
the format used to tag the commit and read it, use it in existing projects, wrap | ||
around simple quotes | ||
--bump-message BUMP_MESSAGE | ||
template used to create the release commit, useful | ||
when working with CI | ||
template used to create the release commit, useful when working with CI | ||
--prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} | ||
choose type of prerelease | ||
--increment {MAJOR,MINOR,PATCH} | ||
manually specify the desired increment | ||
--check-consistency, -cc | ||
check consistency among versions defined in commitizen | ||
configuration and version_files | ||
check consistency among versions defined in commitizen configuration and | ||
version_files | ||
--annotated-tag, -at create annotated tag instead of lightweight one | ||
``` | ||
|
||
### `--changelog` | ||
|
@@ -216,6 +214,15 @@ Some examples | |
bump_message = "release $current_version → $new_version [skip-ci]" | ||
``` | ||
|
||
### `annotated_tag` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for consistency, I'll suggest using |
||
|
||
Whether to create annotated tags or lightweight ones. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If my understand is correct, we can use |
||
```toml | ||
[tool.commitizen] | ||
annotated_tag = true | ||
``` | ||
|
||
## Custom bump | ||
|
||
Read the [customizing section](./customization.md). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can change the help message to
create an annotated tag (by default, commitizen creates lightweight tag)