Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend tag with Python package name if multiple packages are defined #570

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading