Skip to content

Commit

Permalink
Prepend tag with Python package name if multiple packages are defined (
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski authored Apr 20, 2024
1 parent 897a828 commit 24ecdc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 12 additions & 3 deletions jupyter_releaser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,18 @@ def prep_git(ref, branch, repo, auth, username, git_url):
def bump_version(version_spec, version_cmd, changelog_path, python_packages, tag_format):
"""Prep git and env variables and bump version"""
prev_dir = os.getcwd()
for python_package in [p.split(":")[0] for p in python_packages]:
os.chdir(python_package)
lib.bump_version(version_spec, version_cmd, changelog_path, tag_format)
for package in python_packages:
package_path, package_name = (
package.split(":", maxsplit=2) if ":" in package else [package, None]
)
os.chdir(package_path)
lib.bump_version(
version_spec,
version_cmd,
changelog_path,
tag_format,
package_name=package_name if len(python_packages) > 1 else None,
)
os.chdir(prev_dir)


Expand Down
4 changes: 3 additions & 1 deletion jupyter_releaser/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from jupyter_releaser import changelog, npm, python, util


def bump_version(version_spec, version_cmd, changelog_path, tag_format):
def bump_version(version_spec, version_cmd, changelog_path, tag_format, package_name=None):
"""Bump the version and verify new version"""
util.bump_version(version_spec, version_cmd=version_cmd, changelog_path=changelog_path)

Expand All @@ -38,6 +38,8 @@ def bump_version(version_spec, version_cmd, changelog_path, tag_format):

# Bail if tag already exists
tag_name = tag_format.format(version=version)
if package_name:
tag_name = package_name + "-" + tag_name
if tag_name in util.run("git --no-pager tag", quiet=True).splitlines():
msg = f"Tag {tag_name} already exists!"
msg += " To delete run: `git push --delete origin {tag_name}`"
Expand Down

0 comments on commit 24ecdc0

Please sign in to comment.