Skip to content

Commit ffe52ea

Browse files
author
Steven Silvester
authored
Merge pull request #91 from blink1073/preserve-tag
More Cleanup
2 parents 70e5cce + ed03adc commit ffe52ea

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

jupyter_releaser/actions/draft_release.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from subprocess import CalledProcessError
77

88
from jupyter_releaser.util import CHECKOUT_NAME
9+
from jupyter_releaser.util import get_latest_tag
910
from jupyter_releaser.util import log
1011
from jupyter_releaser.util import run
1112

@@ -38,6 +39,14 @@
3839
Path(changelog_location).write_text(changelog_text)
3940

4041
run("jupyter-releaser check-changelog")
42+
43+
# Capture the "since" argument in case we add tags before the second
44+
# "Check Changelog"
45+
curr_dir = os.getcwd()
46+
os.chdir(CHECKOUT_NAME)
47+
os.environ.setdefault("RH_SINCE", get_latest_tag(os.environ["RH_BRANCH"]))
48+
os.chdir(curr_dir)
49+
4150
# Make sure npm comes before python in case it produces
4251
# files for the python package
4352
run("jupyter-releaser build-npm")

jupyter_releaser/changelog.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ def get_version_entry(
6565
str
6666
A formatted changelog entry with markers
6767
"""
68-
if not since:
69-
tags = util.run(f"git --no-pager tag --sort=-creatordate --merged {branch}")
70-
if tags:
71-
since = tags.splitlines()[0]
68+
since = since or util.get_latest_tag(branch)
7269

7370
branch = branch.split("/")[-1]
7471
util.log(f"Getting changes to {repo} since {since} on branch {branch}...")

jupyter_releaser/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def invoke(self, ctx):
8686
before_hooks = hooks[before]
8787
if isinstance(before_hooks, str):
8888
before_hooks = [before_hooks]
89+
if before_hooks:
90+
util.log(f"\nRunning hooks for {before}")
8991
for hook in before_hooks:
9092
util.run(hook)
9193

@@ -104,6 +106,8 @@ def invoke(self, ctx):
104106
after_hooks = hooks[after]
105107
if isinstance(after_hooks, str):
106108
after_hooks = [after_hooks]
109+
if after_hooks:
110+
util.log(f"\nRunning hooks for {after}")
107111
for hook in after_hooks:
108112
util.run(hook)
109113

jupyter_releaser/util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ def actions_output(name, value):
243243
print(f"::set-output name={name}::{value}")
244244

245245

246+
def get_latest_tag(branch):
247+
"""Get the default 'since' value for a branch"""
248+
tags = run(f"git --no-pager tag --sort=-creatordate --merged {branch}")
249+
if tags:
250+
return tags.splitlines()[0]
251+
252+
246253
def read_config():
247254
"""Read the jupyter-releaser config data"""
248255
if JUPYTER_RELEASER_CONFIG.exists():

0 commit comments

Comments
 (0)