@@ -71,21 +71,12 @@ def main():
71
71
72
72
increment = None
73
73
properties = PropertiesFile (str (PROJECT_DIR / "gradle.properties" ))
74
- previous_version = parse_version (properties [PROJECT_VERSION_KEY ])
74
+ version = parse_version (properties [PROJECT_VERSION_KEY ])
75
75
76
76
print ()
77
- print (f"Currently @ { previous_version } ." )
77
+ print (f"Releasing version { version } ." )
78
78
print ()
79
79
80
- while increment not in INCREMENTS .keys ():
81
- increment = input ("How do you want to increment? [major/minor/patch] " )
82
-
83
- new_version = INCREMENTS [increment ](previous_version )
84
-
85
- # Apply new version to project
86
- print (f"Updating project version to { new_version } ..." )
87
- properties [PROJECT_VERSION_KEY ] = str (new_version )
88
-
89
80
# Fetch new changelog message from user
90
81
temp = tempfile .NamedTemporaryFile (delete = False )
91
82
temp_path = Path (temp .name ).absolute ()
@@ -112,14 +103,24 @@ def main():
112
103
113
104
print ("Updating changelog..." )
114
105
changelog = ChangelogFile (PROJECT_DIR / "CHANGELOG.md" )
115
- changelog .prepend_version (new_version , changelog_message )
106
+ changelog .prepend_version (version , changelog_message )
116
107
117
- print ("Creating Git commit and tag..." )
118
- tag_message = "\n " .join ([f"Update version to { new_version } " , "" ] + changelog_message )
119
- commit_message = "\n " .join ([f"Update version to { new_version } " , "" , f"Increment to the next { increment } version." ])
108
+ print ("Creating Git tag..." )
109
+ tag_message = "\n " .join ([f"Version { version } " , "" ] + changelog_message )
110
+ subprocess .run (["git" , "tag" , "-a" , f"{ version } " , "-m" , tag_message ], cwd = PROJECT_DIR )
111
+
112
+ while increment not in INCREMENTS .keys ():
113
+ increment = input ("How do you want to increment? [major/minor/patch] " )
114
+
115
+ new_version = INCREMENTS [increment ](version )
116
+
117
+ # Apply new (development) version to project
118
+ print (f"Updating next dev version to { new_version } ..." )
119
+ properties [PROJECT_VERSION_KEY ] = str (new_version )
120
120
121
+ print ("Creating Git commit for next dev version..." )
122
+ commit_message = f"Bump version to { new_version } "
121
123
subprocess .run (["git" , "add" , "." ], cwd = PROJECT_DIR )
122
124
subprocess .run (["git" , "commit" , "-m" , commit_message ], cwd = PROJECT_DIR )
123
- subprocess .run (["git" , "tag" , "-a" , f"{ new_version } " , "-m" , tag_message ], cwd = PROJECT_DIR )
124
125
125
126
main ()
0 commit comments