Skip to content

Commit

Permalink
refactor: Update version bump script to use separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
crushr3sist committed Jun 18, 2024
1 parent 17201b0 commit e9b5d3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ jobs:
- name: Bump Version
run: |
python -c "import toml, semantic_version; \
with open('pyproject.toml', 'r') as f: data = toml.load(f); \
current_version = semantic_version.Version(data['tool']['semantic-version']['current_version']); \
new_version = current_version.next_patch(); \
data['tool']['semantic-version']['current_version'] = str(new_version); \
with open('pyproject.toml', 'w') as f: toml.dump(data, f); \
print('Version bumped to:', new_version);"
python bump_version.py
- name: Commit changes
run: |
Expand Down
5 changes: 4 additions & 1 deletion update_version.py → bump_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# bump_version.py
import toml
from semantic_version import Version

Expand All @@ -12,6 +13,7 @@ def update_version(new_version, file_path="pyproject.toml"):
with open(file_path, "r") as f:
data = toml.load(f)

# Update the version in the file
data["tool"]["semantic-version"]["current_version"] = str(new_version)

with open(file_path, "w") as f:
Expand All @@ -35,4 +37,5 @@ def bump_version(bump_type="patch"):


# Example usage
bump_version("minor")
if __name__ == "__main__":
bump_version("patch")

0 comments on commit e9b5d3d

Please sign in to comment.