Skip to content

Commit a441599

Browse files
authored
Fix dev version handling in check release (#343)
1 parent e51643c commit a441599

File tree

9 files changed

+40
-10
lines changed

9 files changed

+40
-10
lines changed

.github/actions/draft-release/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ runs:
5858
export RH_SINCE=${{ inputs.since }}
5959
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
6060
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
61+
export RH_USE_CHANGELOG_VERSION=1
62+
export RH_VERSION_CREATE_TAG=1
6163
6264
# Draft Release
6365
python -m jupyter_releaser.actions.draft_release

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
author = "Project Jupyter"
2424

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

jupyter_releaser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
3-
__version__ = "0.22.3"
3+
__version__ = "0.23.0.dev0"

jupyter_releaser/actions/draft_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
os.chdir(curr_dir)
5454

5555

56-
run_action("jupyter-releaser bump-version --use-changelog-version")
56+
run_action("jupyter-releaser bump-version")
5757

5858
with make_group("Handle Check Release"):
5959
if check_release:

jupyter_releaser/cli.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,16 @@ def main(force):
141141
]
142142

143143
version_cmd_options = [
144-
click.option("--version-cmd", envvar="RH_VERSION_COMMAND", help="The version command")
144+
click.option("--version-cmd", envvar="RH_VERSION_COMMAND", help="The version command"),
145+
]
146+
147+
version_create_tag_options = [
148+
click.option(
149+
"--version-create-tag",
150+
envvar="RH_VERSION_CREATE_TAG",
151+
is_flag=True,
152+
help="Whether to create a tag when bumping the version",
153+
),
145154
]
146155

147156

@@ -308,18 +317,28 @@ def prep_git(ref, branch, repo, auth, username, git_url):
308317
@main.command()
309318
@add_options(version_spec_options)
310319
@add_options(version_cmd_options)
320+
@add_options(version_create_tag_options)
311321
@add_options(changelog_path_options)
312322
@add_options(use_changelog_version_options)
313323
@add_options(python_packages_options)
314324
@use_checkout_dir()
315-
def bump_version(version_spec, version_cmd, changelog_path, use_changelog_version, python_packages):
325+
def bump_version(
326+
version_spec,
327+
version_cmd,
328+
version_create_tag,
329+
changelog_path,
330+
use_changelog_version,
331+
python_packages,
332+
):
316333
"""Prep git and env variables and bump version"""
317334
prev_dir = os.getcwd()
318335
for python_package in [p.split(":")[0] for p in python_packages]:
319336
os.chdir(python_package)
320337
lib.bump_version(
321338
version_spec, version_cmd, changelog_path, use_changelog_version=use_changelog_version
322339
)
340+
if version_create_tag:
341+
lib.create_tag()
323342
os.chdir(prev_dir)
324343

325344

jupyter_releaser/lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def bump_version(version_spec, version_cmd, changelog_path, use_changelog_versio
3030
use_changelog_version=use_changelog_version,
3131
)
3232

33+
34+
def create_tag():
3335
version = util.get_version()
36+
assert version is not None
3437

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

5052

jupyter_releaser/tests/test_cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ def test_bump_version_tag_exists(py_package, runner):
144144
runner(["prep-git", "--git-url", py_package])
145145
run("git tag v1.0.1", cwd=util.CHECKOUT_NAME)
146146
with pytest.raises(ValueError):
147-
runner(["bump-version", "--version-spec", "1.0.1"], env=dict(GITHUB_ACTIONS=""))
147+
runner(
148+
["bump-version", "--version-spec", "1.0.1", "--version-create-tag"],
149+
env=dict(GITHUB_ACTIONS=""),
150+
)
148151

149152

150153
def test_list_envvars(runner):
@@ -183,6 +186,7 @@ def test_list_envvars(runner):
183186
use-changelog-version: RH_USE_CHANGELOG_VERSION
184187
username: GITHUB_ACTOR
185188
version-cmd: RH_VERSION_COMMAND
189+
version-create-tag: RH_VERSION_CREATE_TAG
186190
version-spec: RH_VERSION_SPEC
187191
""".strip()
188192
)

jupyter_releaser/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def run(cmd, **kwargs):
5959
quiet_error = kwargs.pop("quiet_error", False)
6060
show_cwd = kwargs.pop("show_cwd", False)
6161
quiet = kwargs.pop("quiet", False)
62-
echo = kwargs.pop("echo", False)
62+
echo = kwargs.pop("echo", True)
6363

6464
if echo:
6565
prefix = "COMMAND"

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

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

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

83+
[tool.jupyter-releaser.options]
84+
post-version-spec = "dev"
85+
8386
[tool.jupyter-releaser.hooks]
8487
after-draft-release = "bash ./.github/scripts/bump_tag.sh"
8588

0 commit comments

Comments
 (0)