Skip to content

Commit

Permalink
adding bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
David committed Mar 19, 2024
1 parent 8046060 commit eb86448
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions bump_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import re
import sys

with open("setup.py", "r") as f:
content = f.read()

# Extract the current version
match = re.search(r'version="([\d.]+)b(\d+)"', content)
if match:
version = match.group(1)
beta_num = int(match.group(2))

new_beta_num = beta_num + 1
new_version = f"{version}b{new_beta_num}"

content = content.replace(
f'version="{version}b{beta_num}"', f'version="{new_version}"'
)

print("new version")
print(f"{new_version}")
with open("setup.py", "w") as f:
f.write(content)

# Output the new version for subsequent GitHub Actions steps
print(f"::set-output name=new_version::{new_version}")
new_version_file = "new_version.txt"
with open(new_version_file, "w") as f:
f.write(new_version)

print(f"::set-output name=new_version::{new_version}")
else:
print("Version pattern not found!")
sys.exit(1)

0 comments on commit eb86448

Please sign in to comment.