@@ -22,42 +22,6 @@ def bump_version(bump_type):
22
22
return new_version
23
23
24
24
25
- def delete_tag (tag ):
26
- # Delete the local and remote tag if it exists
27
- print (f"Deleting existing tag { tag } locally and remotely..." )
28
- subprocess .run (["git" , "tag" , "-d" , tag ], check = True )
29
- subprocess .run (["git" , "push" , "origin" , f":refs/tags/{ tag } " ], check = True )
30
-
31
-
32
- def tag_exists_on_remote (tag ):
33
- result = subprocess .run (
34
- ["git" , "ls-remote" , "--tags" , "origin" , tag ], capture_output = True , text = True
35
- )
36
- return bool (result .stdout .strip ())
37
-
38
-
39
- def update_git (new_version : str , delete_existing_tag : bool = False ):
40
- # Fetch tags to ensure the local repo is up to date
41
- subprocess .run (["git" , "fetch" , "--tags" ], check = True )
42
- tag_name = f"v{ new_version } "
43
-
44
- if tag_exists_on_remote (tag_name ):
45
- if delete_existing_tag :
46
- delete_tag (tag_name )
47
- else :
48
- print (f"Tag { tag_name } already exists on the remote. Aborting!" )
49
- sys .exit (1 )
50
-
51
- subprocess .run (
52
- ["git" , "commit" , "-am" , f"Bump version to { new_version } " ], check = True
53
- )
54
-
55
- subprocess .run (
56
- ["git" , "tag" , tag_name , "-m" , f"Release v{ new_version } " ], check = True
57
- )
58
- subprocess .run (["git" , "push" , "origin" , tag_name ], check = True )
59
-
60
-
61
25
def main ():
62
26
bump_type = "patch"
63
27
@@ -69,9 +33,7 @@ def main():
69
33
70
34
# Bump the version
71
35
new_version = bump_version (bump_type )
72
-
73
- # Commit and tag the changes
74
- update_git (new_version )
36
+ print (f"Bumped version to { new_version } " )
75
37
76
38
77
39
if __name__ == "__main__" :
0 commit comments