Skip to content
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
2 changes: 2 additions & 0 deletions .github/actions/draft-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ runs:
export RH_SINCE=${{ inputs.since }}
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_USE_CHANGELOG_VERSION=1
export RH_VERSION_CREATE_TAG=1

# Draft Release
python -m jupyter_releaser.actions.draft_release
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = "Project Jupyter"

# The full version, including alpha/beta/rc tags.
release = "0.22.3"
release = "0.23.0.dev0"
# The short X.Y version.
version = ".".join(release.split(".")[:2])

Expand Down
2 changes: 1 addition & 1 deletion jupyter_releaser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
__version__ = "0.22.3"
__version__ = "0.23.0.dev0"
2 changes: 1 addition & 1 deletion jupyter_releaser/actions/draft_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
os.chdir(curr_dir)


run_action("jupyter-releaser bump-version --use-changelog-version")
run_action("jupyter-releaser bump-version")

with make_group("Handle Check Release"):
if check_release:
Expand Down
23 changes: 21 additions & 2 deletions jupyter_releaser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,16 @@ def main(force):
]

version_cmd_options = [
click.option("--version-cmd", envvar="RH_VERSION_COMMAND", help="The version command")
click.option("--version-cmd", envvar="RH_VERSION_COMMAND", help="The version command"),
]

version_create_tag_options = [
click.option(
"--version-create-tag",
envvar="RH_VERSION_CREATE_TAG",
is_flag=True,
help="Whether to create a tag when bumping the version",
),
]


Expand Down Expand Up @@ -308,18 +317,28 @@ def prep_git(ref, branch, repo, auth, username, git_url):
@main.command()
@add_options(version_spec_options)
@add_options(version_cmd_options)
@add_options(version_create_tag_options)
@add_options(changelog_path_options)
@add_options(use_changelog_version_options)
@add_options(python_packages_options)
@use_checkout_dir()
def bump_version(version_spec, version_cmd, changelog_path, use_changelog_version, python_packages):
def bump_version(
version_spec,
version_cmd,
version_create_tag,
changelog_path,
use_changelog_version,
python_packages,
):
"""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, use_changelog_version=use_changelog_version
)
if version_create_tag:
lib.create_tag()
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 @@ -30,7 +30,10 @@ def bump_version(version_spec, version_cmd, changelog_path, use_changelog_versio
use_changelog_version=use_changelog_version,
)


def create_tag():
version = util.get_version()
assert version is not None

# A properly parsed version will have a "major" attribute
parsed = parse_version(version)
Expand All @@ -44,7 +47,6 @@ def bump_version(version_spec, version_cmd, changelog_path, use_changelog_versio
msg = f"Tag {tag_name} already exists!"
msg += " To delete run: `git push --delete origin {tag_name}`"
raise ValueError(msg)

return version


Expand Down
6 changes: 5 additions & 1 deletion jupyter_releaser/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def test_bump_version_tag_exists(py_package, runner):
runner(["prep-git", "--git-url", py_package])
run("git tag v1.0.1", cwd=util.CHECKOUT_NAME)
with pytest.raises(ValueError):
runner(["bump-version", "--version-spec", "1.0.1"], env=dict(GITHUB_ACTIONS=""))
runner(
["bump-version", "--version-spec", "1.0.1", "--version-create-tag"],
env=dict(GITHUB_ACTIONS=""),
)


def test_list_envvars(runner):
Expand Down Expand Up @@ -183,6 +186,7 @@ def test_list_envvars(runner):
use-changelog-version: RH_USE_CHANGELOG_VERSION
username: GITHUB_ACTOR
version-cmd: RH_VERSION_COMMAND
version-create-tag: RH_VERSION_CREATE_TAG
version-spec: RH_VERSION_SPEC
""".strip()
)
Expand Down
2 changes: 1 addition & 1 deletion jupyter_releaser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run(cmd, **kwargs):
quiet_error = kwargs.pop("quiet_error", False)
show_cwd = kwargs.pop("show_cwd", False)
quiet = kwargs.pop("quiet", False)
echo = kwargs.pop("echo", False)
echo = kwargs.pop("echo", True)

if echo:
prefix = "COMMAND"
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "jupyter_releaser"
version = "0.22.3"
version = "0.23.0.dev0"
description = "Jupyter Releaser for Python and/or npm packages."
license = {file = "LICENSE"}
authors = [{name = "Jupyter Development Team", email = "[email protected]"}]
Expand Down Expand Up @@ -58,7 +58,7 @@ test = [
jupyter-releaser = "jupyter_releaser.cli:main"

[tool.tbump.version]
current = "0.22.3"
current = "0.23.0.dev0"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
Expand All @@ -80,6 +80,9 @@ src = "docs/source/conf.py"
[tool.jupyter-releaser]
skip = ["check-links"]

[tool.jupyter-releaser.options]
post-version-spec = "dev"

[tool.jupyter-releaser.hooks]
after-draft-release = "bash ./.github/scripts/bump_tag.sh"

Expand Down