Skip to content

Commit

Permalink
update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Jul 16, 2022
1 parent 6d8731e commit e585909
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Wheels
name: Release

on:
push:
Expand Down
4 changes: 4 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Changelog
=========

2.12.3b1 (July 16, 2022)
------------------------
- Minor improvements

2.12.2 (July 15, 2022)
----------------------
- fix a bug in error heuristic when parameters have negative values and prevent assigning negative values to errors (#759)
Expand Down
43 changes: 26 additions & 17 deletions doc/update_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess as subp
from pkg_resources import parse_version
import datetime
import warnings

cwd = Path(__file__).parent

Expand All @@ -11,17 +12,22 @@
exec(f.read(), version)
new_version = parse_version(version["version"])

latest_tag = next(
iter(
sorted(
(
parse_version(x)
for x in subp.check_output(["git", "tag"]).decode().strip().split("\n")
),
reverse=True,
with warnings.catch_warnings():
warnings.simplefilter("ignore")
latest_tag = next(
iter(
sorted(
(
parse_version(x)
for x in subp.check_output(["git", "tag"])
.decode()
.strip()
.split("\n")
),
reverse=True,
)
)
)
)

with open(cwd / "changelog.rst") as f:
content = f.read()
Expand All @@ -44,13 +50,16 @@

today = datetime.date.today()
header = f"{new_version} ({today.strftime('%B %d, %Y')})"
content2 = f"""{content[:position]}{header}
{'-' * len(header)}
"""
for x in git_log:
content2 += f"- {x}\n"
content2 += "\n"
content2 += content[position:]

new_content = f"{header}\n{'-' * len(header)}\n"
if git_log:
for x in git_log:
new_content += f"- {x}\n"
else:
new_content += "- Minor improvements\n"
new_content += "\n"

print(new_content, end="")

with open(cwd / "changelog.rst", "w") as f:
f.write(content2)
f.write(f"{content[:position]}{new_content}{content[position:]}")

0 comments on commit e585909

Please sign in to comment.