33import subprocess
44
55
6- def run_command (command : list [ str ] , error_message : str , success_message : str ) -> None :
6+ def run_command (command : str , error_message : str , success_message : str ) -> None :
77 try :
8- subprocess .run (command , check = True , capture_output = True , text = True )
8+ subprocess .run (command . split () , check = True , capture_output = True , text = True )
99 print (success_message )
1010 except subprocess .CalledProcessError as e :
1111 print (f"{ error_message } : { e .stderr } " )
@@ -24,16 +24,6 @@ def ensure_git_is_clean() -> None:
2424 print ("✅ Git working directory is clean" )
2525
2626
27- def update_version (new_version : str ) -> None :
28- cmd = f"sed -i 's/^version = .*/version = \" { new_version } \" /' pyproject.toml"
29- try :
30- subprocess .run (cmd , shell = True , check = True )
31- print ("✅ Version updated" )
32- except subprocess .CalledProcessError as e :
33- print (f"Error updating version: { e } " )
34- sys .exit (1 )
35-
36-
3727def release ():
3828 if len (sys .argv ) != 2 :
3929 print ("Usage: $0 <new_version>" )
@@ -43,25 +33,24 @@ def release():
4333 print (f"🚀 Will release version: { new_version } " )
4434
4535 ensure_git_is_clean ()
46- update_version (new_version )
4736
4837 run_command (
49- [ "uv" , "lock" , "--upgrade-package" , "mediathequeroubaix" ] ,
50- "Error locking package " ,
51- "✅ Locked dependencies in uv.lock " ,
38+ f "uv version { new_version } " ,
39+ "Error updating version in pyproject.toml " ,
40+ "✅ Updated version in pyproject.toml " ,
5241 )
5342 run_command (
54- [ "git" , " add" , " pyproject.toml" , " uv.lock"] ,
43+ "git add pyproject.toml uv.lock" ,
5544 "Error adding changes" ,
5645 "✅ Updated pyproject.toml and uv.lock" ,
5746 )
5847 run_command (
59- [ "git" , " commit" , " --no-verify" , "-m" , f" chore: bump version to { new_version } "] ,
48+ f "git commit --no-verify -m chore: bump version to { new_version } " ,
6049 "Error committing version change" ,
6150 "✅ Committed version change" ,
6251 )
6352 run_command (
64- [ "git" , " tag" , "-a" , new_version , "-m" , f" Release { new_version } "] ,
53+ f "git tag -a { new_version } -m Release { new_version } " ,
6554 "Error creating git tag" ,
6655 f"✅ Created git tag: { new_version } " ,
6756 )
0 commit comments