-
-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the release workflow #3737
Changes from 7 commits
f44bce5
0fa9ca4
8023fdf
520ddab
4e0c8c0
2198ad7
b60690a
851d378
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,11 @@ def update_version(): | |
Opens file and updates the version number | ||
""" | ||
release_version = os.getenv("VERSION")[1:] | ||
last_day_of_month = date.today() + relativedelta(day=31) | ||
release_date = ( | ||
date.today() | ||
if "rc" in release_version | ||
else date.today() + relativedelta(day=31) | ||
) | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The final release will be at the end of the month, but the rc releases will be in between. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all months have 31 days There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This always returns the last day of the month. The current workflows use the same line and it can be seen that the headings in the CHANGELOG are correct for months that don't have 31 days. |
||
|
||
# pybamm/version.py | ||
with open(os.path.join(pybamm.root_dir(), "pybamm", "version.py"), "r+") as file: | ||
|
@@ -72,16 +76,21 @@ def update_version(): | |
file.write(replace_commit_id) | ||
|
||
changelog_line1 = "# [Unreleased](https://github.com/pybamm-team/PyBaMM/)\n" | ||
changelog_line2 = f"# [v{release_version}](https://github.com/pybamm-team/PyBaMM/tree/v{release_version}) - {last_day_of_month}\n\n" | ||
changelog_line2 = f"# [v{release_version}](https://github.com/pybamm-team/PyBaMM/tree/v{release_version}) - {release_date}\n\n" | ||
|
||
# CHANGELOG.md | ||
with open(os.path.join(pybamm.root_dir(), "CHANGELOG.md"), "r+") as file: | ||
output_list = file.readlines() | ||
output_list[0] = changelog_line1 | ||
# add a new heading for rc0 releases | ||
if "rc0" in release_version: | ||
output_list.insert(2, changelog_line2) | ||
else: | ||
output_list[2] = changelog_line2 | ||
# for rcX and final releases, update the already existing rc | ||
# release heading | ||
for i in range(0, len(output_list)): | ||
if re.search("[v]\d\d\.\drc\d", output_list[i]): | ||
Comment on lines
+85
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For rc0 release, we just need to add a new heading under the "Unreleased" heading. But, for rcX and final releases, the workflow now finds the existing "rc" heading and replaces it with an updated version and date. |
||
output_list[i] = changelog_line2[:-1] | ||
file.truncate(0) | ||
file.seek(0) | ||
file.writelines(output_list) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we don't "sync" the release and develop branches, instead we just update the versions in both the branches independently. This saves us from the conflicts and duplicating the cherry-picked commits.