Skip to content

Commit

Permalink
Fix: Make sure, existing package information is not overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
y0urself committed Mar 1, 2023
1 parent 9a27eac commit 92fd882
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pontos/version/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ def _update_version_file(self, new_version: Version) -> None:
"""
Update the version file with the new version
"""
self.version_file_path.write_text(
TEMPLATE.format(str(new_version)), encoding="utf-8"
)
if self.version_file_path.exists():
version = self.get_current_version()
template = self.version_file_path.read_text(
encoding="utf-8"
).replace(str(version), str(new_version))
else:
template = TEMPLATE.format(str(new_version))
self.version_file_path.write_text(template, encoding="utf-8")

def get_current_version(self) -> Version:
"""Get the current version of this project
Expand Down

0 comments on commit 92fd882

Please sign in to comment.