Skip to content

Commit 9152394

Browse files
authored
Revert changes to handle dev versions (#347)
1 parent b29955a commit 9152394

File tree

12 files changed

+29
-107
lines changed

12 files changed

+29
-107
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ 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
6361
6462
# Draft Release
6563
python -m jupyter_releaser.actions.draft_release

.github/workflows/check-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ jobs:
2222
- name: Check Release
2323
uses: ./.github/actions/check-release
2424
with:
25+
version_spec: 10.10.10
2526
token: ${{ secrets.GITHUB_TOKEN }}

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.23.0.dev0"
26+
release = "0.22.3"
2727
# The short X.Y version.
2828
version = ".".join(release.split(".")[:2])
2929

docs/source/get_started/making_first_release.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ already uses Jupyter Releaser.
4141
4242
![Draft Changelog Workflow Dialog](../images/draft_changelog.png)
4343
44-
- The "New Version Spec" will usually be the full version (e.g. 0.7.1). Repos using `tbump` can also use the "next"
44+
- The "New Version Spec" will usually be the full version (e.g. 0.7.1). Repos using `tbump` can also use the "next" or "patch"
4545
option, which will bump the micro version (or the build version in the case of a prerelease). The "minor" option allows projects using "tbump" to bump
46-
to the next minor version directly.
46+
to the next minor version directly. Note: The "next" and "patch" options
47+
are not available when using dev versions, you must use explicit versions
48+
instead.
4749
- Use the "since" field to select PRs prior to the latest tag to include in the release
4850
- Type "true" in the "since the last stable git tag" if you would like to include PRs since the last non-prerelease version tagged on the target repository and branch.
4951
- The workflow will use the GitHub API to find the relevant pull requests and make an appropriate changelog entry.

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.23.0.dev0"
3+
__version__ = "0.22.3"

jupyter_releaser/changelog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def extract_current(changelog_path):
335335
def extract_current_version(changelog_path):
336336
"""Extract the current released version from the changelog"""
337337
body = extract_current(changelog_path)
338-
match = re.match(r"#+ ([\da-z.]+)", body.strip())
338+
match = re.match(r"#+ ([\d.]+)", body.strip())
339339
if not match:
340340
raise ValueError("Could not find previous version")
341341
return match.groups()[0]

jupyter_releaser/cli.py

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

143143
version_cmd_options = [
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-
),
144+
click.option("--version-cmd", envvar="RH_VERSION_COMMAND", help="The version command")
154145
]
155146

156147

@@ -212,15 +203,6 @@ def main(force):
212203
),
213204
]
214205

215-
use_changelog_version_options = [
216-
click.option(
217-
"--use-changelog-version",
218-
envvar="RH_USE_CHANGELOG_VERSION",
219-
is_flag=True,
220-
help="Whether to use the changelog version if the current version is a dev version in version bump",
221-
),
222-
]
223-
224206
since_options = [
225207
click.option(
226208
"--since",
@@ -317,28 +299,15 @@ def prep_git(ref, branch, repo, auth, username, git_url):
317299
@main.command()
318300
@add_options(version_spec_options)
319301
@add_options(version_cmd_options)
320-
@add_options(version_create_tag_options)
321302
@add_options(changelog_path_options)
322-
@add_options(use_changelog_version_options)
323303
@add_options(python_packages_options)
324304
@use_checkout_dir()
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-
):
305+
def bump_version(version_spec, version_cmd, changelog_path, python_packages):
333306
"""Prep git and env variables and bump version"""
334307
prev_dir = os.getcwd()
335308
for python_package in [p.split(":")[0] for p in python_packages]:
336309
os.chdir(python_package)
337-
lib.bump_version(
338-
version_spec, version_cmd, changelog_path, use_changelog_version=use_changelog_version
339-
)
340-
if version_create_tag:
341-
lib.create_tag()
310+
lib.bump_version(version_spec, version_cmd, changelog_path)
342311
os.chdir(prev_dir)
343312

344313

jupyter_releaser/lib.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@
2121
from jupyter_releaser import changelog, npm, python, util
2222

2323

24-
def bump_version(version_spec, version_cmd, changelog_path, use_changelog_version):
24+
def bump_version(version_spec, version_cmd, changelog_path):
2525
"""Bump the version and verify new version"""
26-
util.bump_version(
27-
version_spec,
28-
version_cmd=version_cmd,
29-
changelog_path=changelog_path,
30-
use_changelog_version=use_changelog_version,
31-
)
32-
26+
util.bump_version(version_spec, version_cmd=version_cmd, changelog_path=changelog_path)
3327

34-
def create_tag():
3528
version = util.get_version()
36-
assert version is not None
3729

3830
# A properly parsed version will have a "major" attribute
3931
parsed = parse_version(version)
@@ -47,6 +39,7 @@ def create_tag():
4739
msg = f"Tag {tag_name} already exists!"
4840
msg += " To delete run: `git push --delete origin {tag_name}`"
4941
raise ValueError(msg)
42+
5043
return version
5144

5245

@@ -257,10 +250,7 @@ def draft_release(
257250
# Bump to post version if given
258251
if post_version_spec:
259252
post_version = bump_version(
260-
post_version_spec,
261-
version_cmd=version_cmd,
262-
changelog_path=changelog_path,
263-
use_changelog_version=False,
253+
post_version_spec, version_cmd=version_cmd, changelog_path=changelog_path
264254
)
265255
util.log(post_version_message.format(post_version=post_version))
266256
util.run(f'git commit -a -m "Bump to {post_version}"')

jupyter_releaser/tests/test_cli.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ def test_bump_version(npm_package, runner):
127127
assert version == "1.0.1-rc0"
128128

129129

130-
def test_bump_version_use_changelog(npm_package, runner):
131-
runner(["prep-git", "--git-url", npm_package])
132-
runner(["bump-version", "--use-changelog-version"])
133-
version = util.get_version()
134-
assert version == "1.0.0"
135-
136-
137130
def test_bump_version_bad_version(py_package, runner):
138131
runner(["prep-git", "--git-url", py_package])
139132
with pytest.raises(CalledProcessError):
@@ -144,10 +137,7 @@ def test_bump_version_tag_exists(py_package, runner):
144137
runner(["prep-git", "--git-url", py_package])
145138
run("git tag v1.0.1", cwd=util.CHECKOUT_NAME)
146139
with pytest.raises(ValueError):
147-
runner(
148-
["bump-version", "--version-spec", "1.0.1", "--version-create-tag"],
149-
env=dict(GITHUB_ACTIONS=""),
150-
)
140+
runner(["bump-version", "--version-spec", "1.0.1"], env=dict(GITHUB_ACTIONS=""))
151141

152142

153143
def test_list_envvars(runner):
@@ -183,10 +173,8 @@ def test_list_envvars(runner):
183173
tag-message: RH_TAG_MESSAGE
184174
twine-cmd: TWINE_COMMAND
185175
twine-registry: TWINE_REGISTRY
186-
use-changelog-version: RH_USE_CHANGELOG_VERSION
187176
username: GITHUB_ACTOR
188177
version-cmd: RH_VERSION_COMMAND
189-
version-create-tag: RH_VERSION_CREATE_TAG
190178
version-spec: RH_VERSION_SPEC
191179
""".strip()
192180
)

jupyter_releaser/tests/test_functions.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import shutil
66
from pathlib import Path
77

8+
import pytest
89
import toml
910
from ghapi.core import GhApi
1011

@@ -294,30 +295,16 @@ def test_bump_version_reg(py_package):
294295

295296

296297
def test_bump_version_dev(py_package):
297-
changelog_path = py_package / "CHANGELOG.md"
298298
util.bump_version("dev")
299299
assert util.get_version() == "0.1.0.dev0"
300300
util.bump_version("dev")
301301
assert util.get_version() == "0.1.0.dev1"
302-
# Should get the version from the changelog
303-
util.bump_version("next", changelog_path=changelog_path)
304-
assert util.get_version() == "0.0.2"
305-
util.bump_version("dev")
306-
assert util.get_version() == "0.1.0.dev0"
307-
util.bump_version("patch", changelog_path=changelog_path, use_changelog_version=True)
308-
assert util.get_version() == "0.0.1"
309-
util.bump_version("1.0.0.dev0")
310-
text = changelog_path.read_text(encoding="utf-8")
311-
text = text.replace("0.0.1", "0.0.1a1")
312-
changelog_path.write_text(text, encoding="utf-8")
313-
util.bump_version("patch", changelog_path=changelog_path)
314-
assert util.get_version() == "0.0.1a2"
315-
util.bump_version("1.0.0.dev0")
316-
util.bump_version("patch", changelog_path=changelog_path, use_changelog_version=True)
317-
assert util.get_version() == "0.0.1a1"
318-
util.bump_version("1.0.0.dev0")
302+
with pytest.raises(ValueError):
303+
util.bump_version("next")
304+
with pytest.raises(ValueError):
305+
util.bump_version("patch")
319306
util.bump_version("minor")
320-
assert util.get_version() == "1.0.0"
307+
assert util.get_version() == "0.1.0"
321308

322309

323310
def test_get_config_python(py_package):

0 commit comments

Comments
 (0)