Skip to content

Commit ead1f81

Browse files
only replace first instance of version string in cargo
1 parent 1c92222 commit ead1f81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

increment_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def bump_version(major: int, minor: int, patch: int, part: str) -> str:
4343

4444
def update_cargo_toml(file_path: Path, new_version: str) -> None:
4545
content = file_path.read_text()
46-
content = re.sub(r'version = "(\d+\.\d+\.\d+)"', f'version = "{new_version}"', content)
46+
content = re.sub(r'version = "(\d+\.\d+\.\d+)"', f'version = "{new_version}"', content, count=1)
4747
file_path.write_text(content)
4848

4949

5050
def update_changelog(file_path: Path, new_version: str) -> None:
5151
today = datetime.datetime.now(tz=datetime.timezone.utc).strftime("%Y-%m-%d")
5252
content = file_path.read_text()
5353
new_section = f"## UNRELEASED\n\n## {new_version} ({today})"
54-
content = content.replace("## UNRELEASED", new_section)
54+
content = content.replace("## UNRELEASED", new_section, 1)
5555
file_path.write_text(content)
5656

5757

0 commit comments

Comments
 (0)