Skip to content

fix(version-cmd)!: drop implied tag #959

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ For example, assuming a project is currently at version 1.2.3::
************************

Whether or not to perform a ``git commit`` on modifications to source files made by ``semantic-release`` during this
command invocation, and to run ``git tag`` on this new commit with a tag corresponding to the new version.
command invocation.

If ``--no-commit`` is supplied, it may disable other options derivatively; please see below.

Expand All @@ -324,8 +324,7 @@ If ``--no-commit`` is supplied, it may disable other options derivatively; pleas
************************

Whether or not to perform a ``git tag`` to apply a tag of the corresponding to the new version during this
command invocation. This option manages the tag application separate from the commit handled by the ``--commit``
option.
command invocation.

If ``--no-tag`` is supplied, it may disable other options derivatively; please see below.

Expand Down Expand Up @@ -353,7 +352,7 @@ version released.
Whether or not to push new commits and/or tags to the remote repository.

**Default:** ``--no-push`` if :ref:`--no-commit <cmd-version-option-commit>` and
:ref:`--no-tag <cmd-version-option-tag>` is also supplied, otherwise ``push`` is the default.
:ref:`--no-tag <cmd-version-option-tag>` is supplied, otherwise ``push`` is the default.

.. _cmd-version-option-vcs-release:

Expand All @@ -365,7 +364,7 @@ releases in GitHub and Gitea remotes are supported. If releases aren't supported
remote VCS, this option will not cause a command failure, but will produce a warning.

**Default:** ``--no-vcs-release`` if ``--no-push`` is supplied (including where this is
implied by supplying only ``--no-commit``), otherwise ``--vcs-release``
implied by supplying ``--no-commit`` or ``--no-tag``), otherwise ``--vcs-release``

``--skip-build``
****************
Expand Down
24 changes: 14 additions & 10 deletions semantic_release/cli/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,20 +446,24 @@ def version( # noqa: C901
log.info("Forcing use of %s as the prerelease token", prerelease_token)
translator.prerelease_token = prerelease_token

# Only push if we're committing changes
# Only push if changes are committed or tagged
if push_changes and not commit_changes and not create_tag:
log.info("changes will not be pushed because --no-commit disables pushing")
log.info(
"changes will not be pushed because --no-commit --no-tag disables pushing"
)
push_changes &= commit_changes

# Only push if we're creating a tag
if push_changes and not create_tag and not commit_changes:
log.info("new tag will not be pushed because --no-tag disables pushing")
push_changes &= create_tag

# Only make a release if we're pushing the changes
# Only make a release if changes are pushed
if make_vcs_release and not push_changes:
log.info("No vcs release will be created because pushing changes is disabled")
make_vcs_release &= push_changes
# Only make a release if changes are committed
if make_vcs_release and not commit_changes:
log.info("No vcs release will be created because --no-commit disables release")
make_vcs_release &= commit_changes
# Only make a release if tagged
if make_vcs_release and not create_tag:
log.info("No vcs release will be created because --no-tag disables release")
make_vcs_release &= create_tag

if not forced_level_bump:
with Repo(str(runtime.repo_dir)) as git_repo:
Expand Down Expand Up @@ -648,7 +652,7 @@ def version( # noqa: C901
# are disabled, and the changelog generation is disabled or it's not
# modified, then the HEAD commit will be tagged as a release commit
# despite not being made by PSR
if commit_changes or create_tag:
if create_tag:
project.git_tag(
tag_name=new_version.as_tag(),
message=new_version.as_tag(),
Expand Down
Loading