@@ -289,6 +289,25 @@ def build_js(session: Session) -> None:
289289@nox .session
290290def tag (session : Session ) -> None :
291291 """Create a new git tag"""
292+ try :
293+ session .run (
294+ "git" ,
295+ "diff" ,
296+ "--cached" ,
297+ "--exit-code" ,
298+ silent = True ,
299+ external = True ,
300+ )
301+ session .run (
302+ "git" ,
303+ "diff" ,
304+ "--exit-code" ,
305+ silent = True ,
306+ external = True ,
307+ )
308+ except Exception :
309+ session .error ("Cannot create a tag - there are uncommited changes" )
310+
292311 if len (session .posargs ) > 1 :
293312 session .error ("To many arguments" )
294313
@@ -312,17 +331,6 @@ def tag(session: Session) -> None:
312331 # trigger npm install to update package-lock.json
313332 session .install ("-e" , "." )
314333
315- try :
316- session .run (
317- "git" ,
318- "diff" ,
319- "--cached" ,
320- "--exit-code" ,
321- external = True ,
322- )
323- except Exception :
324- session .error ("Cannot create a tag - there are uncommited changes" )
325-
326334 version = get_version ()
327335 install_requirements_file (session , "make-release" )
328336 session .run ("pysemver" , "check" , version )
@@ -339,15 +347,15 @@ def tag(session: Session) -> None:
339347 )
340348
341349 if session .interactive :
342- response = input ("confirm (yes/no): " ).lower ()
350+ response = input ("Confirm (yes/no): " ).lower ()
343351 if response != "yes" :
344- return None
352+ session . error ( "Did not create tag" )
345353
346354 # stage, commit, tag, and push version bump
347- session .run ("git" , "add" , "--all" )
348- session .run ("git" , "commit" , "-m" , repr (f"update version to { new_version } " ))
355+ session .run ("git" , "add" , "--all" , external = True )
356+ session .run ("git" , "commit" , "-m" , repr (f"version { new_version } " ), external = True )
349357 session .run ("git" , "tag" , version , external = True )
350- session .run ("git" , "push" , "--tags" , external = True )
358+ session .run ("git" , "push" , "origin" , "main" , " --tags" , external = True )
351359
352360
353361@nox .session (reuse_venv = True )
0 commit comments