@@ -166,14 +166,34 @@ def create_github_release(version: str, dry_run: bool = False) -> None:
166166 else :
167167 print (f"Would create tag: { tag } " )
168168
169+ def update_init_version (new_version : str ) -> None :
170+ """Update version in __init__.py file."""
171+ init_file = Path ("commitloom/__init__.py" )
172+
173+ with open (init_file ) as f :
174+ content = f .read ()
175+
176+ # Update the version line
177+ updated_content = re .sub (
178+ r'__version__ = "[^"]*"' ,
179+ f'__version__ = "{ new_version } "' ,
180+ content
181+ )
182+
183+ with open (init_file , "w" ) as f :
184+ f .write (updated_content )
185+
169186def create_version_commits (new_version : str ) -> None :
170187 """Create granular commits for version changes."""
171- # 1. Update version in pyproject.toml
172- run_command ('git add pyproject.toml' )
188+ # 1. Update version in __init__.py
189+ update_init_version (new_version )
190+
191+ # 2. Add both version files and commit
192+ run_command ('git add pyproject.toml commitloom/__init__.py' )
173193 run_command (f'git commit -m "build: bump version to { new_version } "' )
174194 print ("✅ Committed version bump" )
175195
176- # 2 . Update changelog
196+ # 3 . Update changelog
177197 update_changelog (new_version )
178198 run_command ('git add CHANGELOG.md' )
179199 run_command (f'git commit -m "docs: update changelog for { new_version } "' )
0 commit comments