-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b35617e
commit ef81958
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env -S uv run | ||
from pathlib import Path | ||
|
||
REPO_ROOT = Path(__file__).parent.parent | ||
CHANGELOG_MD = REPO_ROOT / "CHANGELOG.md" | ||
RELEASE_NOTES_MD = REPO_ROOT / "docs" / "release-notes.md" | ||
|
||
|
||
def get_releases() -> str: | ||
with CHANGELOG_MD.open() as f: | ||
changelog_md = f.read() | ||
|
||
sections = changelog_md.split("\n## ")[1:] | ||
unreleased = sections.pop(0) | ||
# small sanity check | ||
if not unreleased.startswith("[Unreleased]"): | ||
raise ValueError("Unexpected CHANGELOG.md format, aborting!") | ||
|
||
return "\n\n".join(f"## {section.strip()}" for section in sections) | ||
|
||
|
||
def main() -> None: | ||
releases = get_releases() | ||
|
||
release_notes_md = f"# Release Notes\n\n{releases}\n" | ||
|
||
with RELEASE_NOTES_MD.open("w") as f: | ||
f.write(release_notes_md) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |