ci: take the release page's prose from the CHANGELOG too (#391)

Leaving the lead summary and the upgrade notes to be composed at publish
time put the writing at the worst possible moment — weeks after the changes,
with no review. Both belong in the CHANGELOG entry, which the release PR is
already editing.

The lead needed no code: text between the version heading and the first
group already flowed into the page. The Upgrade group did — CI appended its
own `## Upgrade`, so a CHANGELOG that carried upgrade notes produced two
headings. The group is now lifted out and the boilerplate wrapped around it,
pip line above, compare link below, matching every page since 1.1.3.

Publishing is now a read-through and a click.

Co-authored-by: zhanghui <zhanghui@shanda.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zhanghui
2026-08-07 11:01:40 +08:00
committed by GitHub
co-authored by zhanghui Claude Opus 5
parent 72c1facdbf
commit d5668dcba1
2 changed files with 44 additions and 21 deletions
+13 -2
View File
@@ -109,8 +109,17 @@ jobs:
body = re.sub(r"^### ", "## ", match.group(1).strip(), flags=re.M) + "\n"
# Every EverOS release page since 1.1.3 closes with an Upgrade
# section. Only its boilerplate is prefilled here — a release that
# needs migration notes gets them written into the draft by hand.
# section: the pip line, then whatever this release needs a reader to
# know before upgrading, then the compare link. The prose comes from
# an `### Upgrade` group in the CHANGELOG section — written in the
# release PR, where it gets reviewed — and is lifted out here so the
# boilerplate can be wrapped around it instead of colliding with it.
upgrade = ""
found = re.search(r"^## Upgrade\n(.*?)(?=^## |\Z)", body, re.S | re.M)
if found is not None:
upgrade = found.group(1).strip()
body = (body[: found.start()] + body[found.end() :]).rstrip() + "\n"
tags = subprocess.run(
["git", "tag", "--list", "v*", "--sort=-v:refname"],
capture_output=True, text=True, check=True,
@@ -123,6 +132,8 @@ jobs:
)
body += "\n## Upgrade\n\n```bash\npip install --upgrade everos # or: uv sync\n```\n"
if upgrade:
body += f"\n{upgrade}\n"
if previous is not None:
compare = f"https://github.com/{os.environ['REPO']}/compare/{previous}...{tag}"
body += f"\n**Full changelog:** [{previous}...{tag}]({compare})\n"