Skip to content

Commit a990aa7

Browse files
authored
fix(cmd-version): fix --print-tag result to match configured tag format (#1134)
* test(fixtures): add new trunk repo that has a different tag format * test(fixtures): add helper to extract config settings from repo action definition * test(cmd-version): expand testing of `--print-tag` & `--print-last-released-tag` PSR did not have enough testing to demonstrate testing of the tag generation when the tag format was configured differently than normal. This commit adds a significant portion of testing to exercise the print tag functionality which must match the configured tag format.
1 parent 33b9371 commit a990aa7

File tree

4 files changed

+437
-18
lines changed

4 files changed

+437
-18
lines changed

src/semantic_release/cli/commands/version.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,8 @@ def version( # noqa: C901
516516
gha_output.version = new_version
517517
ctx.call_on_close(gha_output.write_if_possible)
518518

519-
# Make string variant of version && Translate to tag if necessary
520-
version_to_print = (
521-
str(new_version)
522-
if not print_only_tag
523-
else translator.str_to_tag(str(new_version))
524-
)
519+
# Make string variant of version or appropriate tag as necessary
520+
version_to_print = str(new_version) if not print_only_tag else new_version.as_tag()
525521

526522
# Print the new version so that command-line output capture will work
527523
click.echo(version_to_print)

0 commit comments

Comments
 (0)