gradio/scripts/format_release_notes.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.1 KiB
Python
Raw Normal View History

Automated Release Notes (#2306) * add changelog file * Check release notes * Fix syntax * Fix path to changelog * Use changelog * Add to changelog * Add comment * Test comment * Use txt file for comment body * Fix for multiline * rendering on website, changes to changelog * Don't use txt file * Fix pr number * merge * Split it up into two * Test fail * Follow example * Fix syntax * Delete quotes * Add syntax * Fix names * Fix syntax * Modify pr template instead and remove backticks * Check word * changelog file fixes * add 3.4 release notes to changelog * add navigation * replace pr tag and @ usernames with links * remove empty/unused sections from rendering * fix format of 3.4 notes * add releases dir and 3.0-2 notes * render from releases dir * remove changelog file * Fix RN check * Fix path * upcoming release title * switch to periods from dashes * add link to changelog in docs * Add script modify files * Modify changelog * change to release history * modify gh actions * Fix syntax * Skip draft releases during reformatting * skip template when rendering * modify upcoming.md to reflect real changes * replace links with pr tag * Add automated release notes as a new feature in upcoming * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * eUpdate website/homepage/src/style.css Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Misc fixes * one file at root * Fix Changelog check * Modify release notes format script * Fix format script + release notes * Add to contributing * Undo change to release notes from testing script * Add pr 2373 to rl * Modify file path * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-04 03:36:59 +08:00
import argparse
import pathlib
Automated Release Notes (#2306) * add changelog file * Check release notes * Fix syntax * Fix path to changelog * Use changelog * Add to changelog * Add comment * Test comment * Use txt file for comment body * Fix for multiline * rendering on website, changes to changelog * Don't use txt file * Fix pr number * merge * Split it up into two * Test fail * Follow example * Fix syntax * Delete quotes * Add syntax * Fix names * Fix syntax * Modify pr template instead and remove backticks * Check word * changelog file fixes * add 3.4 release notes to changelog * add navigation * replace pr tag and @ usernames with links * remove empty/unused sections from rendering * fix format of 3.4 notes * add releases dir and 3.0-2 notes * render from releases dir * remove changelog file * Fix RN check * Fix path * upcoming release title * switch to periods from dashes * add link to changelog in docs * Add script modify files * Modify changelog * change to release history * modify gh actions * Fix syntax * Skip draft releases during reformatting * skip template when rendering * modify upcoming.md to reflect real changes * replace links with pr tag * Add automated release notes as a new feature in upcoming * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * eUpdate website/homepage/src/style.css Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Misc fixes * one file at root * Fix Changelog check * Modify release notes format script * Fix format script + release notes * Add to contributing * Undo change to release notes from testing script * Add pr 2373 to rl * Modify file path * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-04 03:36:59 +08:00
import textwrap
current_dir = (pathlib.Path(__file__).parent / "..").resolve()
TEMPLATE = """# Upcoming Release
## New Features:
No changes to highlight.
## Bug Fixes:
No changes to highlight.
## Other Changes:
Automated Release Notes (#2306) * add changelog file * Check release notes * Fix syntax * Fix path to changelog * Use changelog * Add to changelog * Add comment * Test comment * Use txt file for comment body * Fix for multiline * rendering on website, changes to changelog * Don't use txt file * Fix pr number * merge * Split it up into two * Test fail * Follow example * Fix syntax * Delete quotes * Add syntax * Fix names * Fix syntax * Modify pr template instead and remove backticks * Check word * changelog file fixes * add 3.4 release notes to changelog * add navigation * replace pr tag and @ usernames with links * remove empty/unused sections from rendering * fix format of 3.4 notes * add releases dir and 3.0-2 notes * render from releases dir * remove changelog file * Fix RN check * Fix path * upcoming release title * switch to periods from dashes * add link to changelog in docs * Add script modify files * Modify changelog * change to release history * modify gh actions * Fix syntax * Skip draft releases during reformatting * skip template when rendering * modify upcoming.md to reflect real changes * replace links with pr tag * Add automated release notes as a new feature in upcoming * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * eUpdate website/homepage/src/style.css Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Misc fixes * one file at root * Fix Changelog check * Modify release notes format script * Fix format script + release notes * Add to contributing * Undo change to release notes from testing script * Add pr 2373 to rl * Modify file path * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-04 03:36:59 +08:00
No changes to highlight.
## Breaking Changes:
No changes to highlight.
"""
def format_release_notes(latest_version: str):
upcoming = current_dir / "CHANGELOG.md"
with open(upcoming, "r") as latest:
lines = latest.readlines()
2022-10-07 02:39:48 +08:00
assert "# Upcoming Release" in lines[0]
Automated Release Notes (#2306) * add changelog file * Check release notes * Fix syntax * Fix path to changelog * Use changelog * Add to changelog * Add comment * Test comment * Use txt file for comment body * Fix for multiline * rendering on website, changes to changelog * Don't use txt file * Fix pr number * merge * Split it up into two * Test fail * Follow example * Fix syntax * Delete quotes * Add syntax * Fix names * Fix syntax * Modify pr template instead and remove backticks * Check word * changelog file fixes * add 3.4 release notes to changelog * add navigation * replace pr tag and @ usernames with links * remove empty/unused sections from rendering * fix format of 3.4 notes * add releases dir and 3.0-2 notes * render from releases dir * remove changelog file * Fix RN check * Fix path * upcoming release title * switch to periods from dashes * add link to changelog in docs * Add script modify files * Modify changelog * change to release history * modify gh actions * Fix syntax * Skip draft releases during reformatting * skip template when rendering * modify upcoming.md to reflect real changes * replace links with pr tag * Add automated release notes as a new feature in upcoming * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * eUpdate website/homepage/src/style.css Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Misc fixes * one file at root * Fix Changelog check * Modify release notes format script * Fix format script + release notes * Add to contributing * Undo change to release notes from testing script * Add pr 2373 to rl * Modify file path * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-04 03:36:59 +08:00
with open(upcoming, "w") as latest:
if latest_version.startswith("v"):
lines[0] = latest_version.replace("v", "# Version ") + "\n"
else:
lines[0] = "# Version " + latest_version + "\n"
Automated Release Notes (#2306) * add changelog file * Check release notes * Fix syntax * Fix path to changelog * Use changelog * Add to changelog * Add comment * Test comment * Use txt file for comment body * Fix for multiline * rendering on website, changes to changelog * Don't use txt file * Fix pr number * merge * Split it up into two * Test fail * Follow example * Fix syntax * Delete quotes * Add syntax * Fix names * Fix syntax * Modify pr template instead and remove backticks * Check word * changelog file fixes * add 3.4 release notes to changelog * add navigation * replace pr tag and @ usernames with links * remove empty/unused sections from rendering * fix format of 3.4 notes * add releases dir and 3.0-2 notes * render from releases dir * remove changelog file * Fix RN check * Fix path * upcoming release title * switch to periods from dashes * add link to changelog in docs * Add script modify files * Modify changelog * change to release history * modify gh actions * Fix syntax * Skip draft releases during reformatting * skip template when rendering * modify upcoming.md to reflect real changes * replace links with pr tag * Add automated release notes as a new feature in upcoming * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * eUpdate website/homepage/src/style.css Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Misc fixes * one file at root * Fix Changelog check * Modify release notes format script * Fix format script + release notes * Add to contributing * Undo change to release notes from testing script * Add pr 2373 to rl * Modify file path * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-04 03:36:59 +08:00
lines = textwrap.dedent(TEMPLATE).splitlines(keepends=True) + lines
latest.writelines(lines)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Upload a demo to a space")
parser.add_argument("latest_version", type=str, help="Name of demo to upload")
args = parser.parse_args()
format_release_notes(args.latest_version)