@@ -289,13 +289,35 @@ def build_js(session: Session) -> None:
289289@nox .session
290290def tag (session : Session ) -> None :
291291 """Create a new git tag"""
292+ if len (session .posargs ) > 1 :
293+ session .error ("To many arguments" )
294+
295+ try :
296+ new_version = session .posargs [0 ]
297+ except IndexError :
298+ session .error ("No version tag given" )
299+
300+ install_requirements_file (session , "make-release" )
301+
302+ # check that version is valid semver
303+ session .run ("pysemver" , "check" , new_version )
304+
305+ old_version = get_version ()
306+ session .log (f"Old version: { old_version } " )
307+ session .log (f"New version: { new_version } " )
308+ set_version (new_version )
309+
310+ session .run ("python" , "scripts/update_versions.py" )
311+
312+ # trigger npm install to update package-lock.json
313+ session .install ("-e" , "." )
314+
292315 try :
293316 session .run (
294317 "git" ,
295318 "diff" ,
296319 "--cached" ,
297320 "--exit-code" ,
298- silent = True ,
299321 external = True ,
300322 )
301323 except Exception :
@@ -305,7 +327,7 @@ def tag(session: Session) -> None:
305327 install_requirements_file (session , "make-release" )
306328 session .run ("pysemver" , "check" , version )
307329
308- changelog_file = ROOT / "docs" / "source" / "developing-idom " / "changelog.rst"
330+ changelog_file = ROOT / "docs" / "source" / "about " / "changelog.rst"
309331 for line in changelog_file .read_text ().splitlines ():
310332 if line == version :
311333 session .log (f"Found changelog section for version { version } " )
@@ -316,37 +338,17 @@ def tag(session: Session) -> None:
316338 f"make sure you have a title section called { version } ."
317339 )
318340
319- session .run ("git" , "tag" , version , external = True )
320-
321- if "push" in session .posargs :
322- session .run ("git" , "push" , "--tags" , external = True )
341+ if session .interactive :
342+ session .log ()
343+ response = input ("confirm (yes/no): " ).lower ()
344+ if response != "yes" :
345+ return None
323346
324-
325- @nox .session
326- def update_version (session : Session ) -> None :
327- """Update the version of all Python and Javascript packages in this repo"""
328- if len (session .posargs ) > 1 :
329- session .error ("To many arguments" )
330-
331- try :
332- new_version = session .posargs [0 ]
333- except IndexError :
334- session .error ("No version tag given" )
335-
336- install_requirements_file (session , "make-release" )
337-
338- # check that version is valid semver
339- session .run ("pysemver" , "check" , new_version )
340-
341- old_version = get_version ()
342- session .log (f"Old version: { old_version } " )
343- session .log (f"New version: { new_version } " )
344- set_version (new_version )
345-
346- session .run ("python" , "scripts/update_versions.py" )
347-
348- # trigger npm install to update package-lock.json
349- session .install ("-e" , "." )
347+ # stage, commit, tag, and push version bump
348+ session .run ("git" , "add" , "--all" )
349+ session .run ("git" , "commit" , "-m" , repr (f"update version to { new_version } " ))
350+ session .run ("git" , "tag" , version , external = True )
351+ session .run ("git" , "push" , "--tags" , external = True )
350352
351353
352354@nox .session (reuse_venv = True )
0 commit comments