Skip to content

Commit

Permalink
fix(cli-version): change implementation to only push the tag we gener…
Browse files Browse the repository at this point in the history
…ated

Restricts the git push command to only push the explicit tag we created
which will eliminate the possibility of pushing another tag that could
cause an error.

Resolves: #803
  • Loading branch information
codejedi365 committed Mar 24, 2024
1 parent 4c998b7 commit 8a9da4f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions semantic_release/cli/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,17 @@ def custom_git_environment() -> ContextManager[None]:
indented(
f"""
would have run:
git push --tags {runtime.masker.mask(remote_url)} {active_branch}
git push {runtime.masker.mask(remote_url)} tag {new_version.as_tag()}
""" # noqa: E501
)
)
elif create_tag:
repo.git.push("--tags", remote_url, active_branch)
# push specific tag refspec (that we made) to remote
# ---------------
# Resolves issue #803 where a tag that already existed was pushed and caused
# a failure. Its not clear why there was an incorrect tag (likely user error change)
# but we will avoid possibly pushing an separate tag that we didn't create.
repo.git.push(remote_url, "tag", new_version.as_tag())

gha_output.released = True

Expand Down

0 comments on commit 8a9da4f

Please sign in to comment.