Skip to content

Commit 53315f8

Browse files
committed
Refactor release script for improved readability
- Cleaned up whitespace in scripts/release.py for better code clarity - Ensured consistent formatting in function definitions and comments
1 parent b0b1e26 commit 53315f8

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

scripts/release.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_current_version():
4141
def increment_version(version, bump_type):
4242
"""Increment version based on bump type."""
4343
parts = [int(x) for x in version.split(".")]
44-
44+
4545
if bump_type == "major":
4646
parts[0] += 1
4747
parts[1] = 0
@@ -53,7 +53,7 @@ def increment_version(version, bump_type):
5353
parts[2] += 1
5454
else:
5555
raise ValueError(f"Invalid bump type: {bump_type}")
56-
56+
5757
return ".".join(map(str, parts))
5858

5959

@@ -70,13 +70,13 @@ def check_working_directory_clean():
7070
def create_and_push_tag(version):
7171
"""Create a Git tag and push it."""
7272
tag_name = f"v{version}"
73-
73+
7474
print(f"Creating tag: {tag_name}")
7575
run_command(f"git tag -a {tag_name} -m 'Release {version}'")
76-
76+
7777
print(f"Pushing tag: {tag_name}")
7878
run_command(f"git push origin {tag_name}")
79-
79+
8080
print(f"✅ Successfully created and pushed tag {tag_name}")
8181
print(f"🚀 GitHub Actions will now build and release version {version}")
8282

@@ -85,14 +85,14 @@ def main():
8585
parser = argparse.ArgumentParser(description="Create a new release")
8686
parser.add_argument(
8787
"version_or_bump",
88-
help="Version bump type (major, minor, patch) or specific version (e.g., 1.2.3)"
88+
help="Version bump type (major, minor, patch) or specific version (e.g., 1.2.3)",
8989
)
90-
90+
9191
args = parser.parse_args()
92-
92+
9393
# Check if working directory is clean
9494
check_working_directory_clean()
95-
95+
9696
# Determine new version
9797
if args.version_or_bump in ["major", "minor", "patch"]:
9898
current_version = get_current_version()
@@ -102,13 +102,13 @@ def main():
102102
else:
103103
new_version = args.version_or_bump
104104
print(f"Setting version to: {new_version}")
105-
105+
106106
# Confirm with user
107107
response = input(f"Create release {new_version}? [y/N]: ")
108-
if response.lower() != 'y':
108+
if response.lower() != "y":
109109
print("Release cancelled.")
110110
sys.exit(0)
111-
111+
112112
# Create and push tag
113113
create_and_push_tag(new_version)
114114

0 commit comments

Comments
 (0)