2222from jupyter_releaser import changelog , npm , python , util
2323
2424
25- def bump_version (version_spec , version_cmd , changelog_path ):
25+ def bump_version (version_spec , version_cmd , changelog_path , tag_format ):
2626 """Bump the version and verify new version"""
2727 util .bump_version (version_spec , version_cmd = version_cmd , changelog_path = changelog_path )
2828
@@ -36,7 +36,7 @@ def bump_version(version_spec, version_cmd, changelog_path):
3636 raise ValueError (msg )
3737
3838 # Bail if tag already exists
39- tag_name = f"v { version } "
39+ tag_name = tag_format . format ( version = version )
4040 if tag_name in util .run ("git --no-pager tag" , quiet = True ).splitlines ():
4141 msg = f"Tag { tag_name } already exists!"
4242 msg += " To delete run: `git push --delete origin {tag_name}`"
@@ -57,12 +57,14 @@ def draft_changelog(
5757 dry_run ,
5858 post_version_spec ,
5959 post_version_message ,
60+ tag_format ,
6061):
6162 """Create a changelog entry PR"""
6263 repo = repo or util .get_repo ()
6364 branch = branch or util .get_branch ()
6465 version = util .get_version ()
6566 prerelease = util .is_prerelease (version )
67+ tag_name = tag_format .format (version = version )
6668
6769 current_sha = util .run ("git rev-parse HEAD" )
6870
@@ -73,8 +75,8 @@ def draft_changelog(
7375 util .log (npm_versions )
7476
7577 tags = util .run ("git --no-pager tag" , quiet = True )
76- if f"v { version } " in tags .splitlines ():
77- msg = f"Tag v { version } already exists"
78+ if tag_name in tags .splitlines ():
79+ msg = f"Tag { tag_name } already exists"
7880 raise ValueError (msg )
7981
8082 current = changelog .extract_current (changelog_path )
@@ -110,7 +112,7 @@ def draft_changelog(
110112 json .dump (data , fid )
111113
112114 release = gh .create_release (
113- f"v { version } " , branch , f"v { version } " , current , True , prerelease , files = [metadata_path ]
115+ tag_name , branch , tag_name , current , True , prerelease , files = [metadata_path ]
114116 )
115117
116118 # Remove draft releases over a day old
@@ -209,6 +211,7 @@ def populate_release(
209211 post_version_spec ,
210212 post_version_message ,
211213 assets ,
214+ tag_format ,
212215):
213216 """Populate release assets and push tags and commits"""
214217 branch = branch or util .get_branch ()
@@ -221,7 +224,10 @@ def populate_release(
221224 # Bump to post version if given.
222225 if post_version_spec :
223226 post_version = bump_version (
224- post_version_spec , version_cmd = version_cmd , changelog_path = changelog_path
227+ post_version_spec ,
228+ version_cmd = version_cmd ,
229+ changelog_path = changelog_path ,
230+ tag_format = tag_format ,
225231 )
226232 util .log (post_version_message .format (post_version = post_version ))
227233 util .run (f'git commit -a -m "Bump to { post_version } "' )
0 commit comments