Commit 02a92eb9 authored by liziwl's avatar liziwl
Browse files

更新发布脚本

parent 378535d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ Changelog 维护应保持最新版本在文件上面的原则,日期格式按
- 预发布版本使用形如 "`[1.0.2-rc.1] - 2021-06-11`" 作为二级标题,
- 正式发布版本使用形如 "`[1.0.1] - 2020-07-25`" 作为二级标题。

<!-- BODY -->
<!-- BODY 正文标记,请勿移除 -->

## [Unreleased](https://github.com/SUSTech-CRA/sustech-master-thesis/compare/v1.3.21...HEAD)

+4 −4
Original line number Diff line number Diff line
@@ -47,8 +47,7 @@ def generate_changelog_md(old_version, new_version, date):
- 这里可以添加具体的修复内容,根据实际情况调整。

### Removed
- 这里可以添加具体的修复内容,根据实际情况调整。
"""
- 这里可以添加具体的修复内容,根据实际情况调整。"""

    return md_template

@@ -57,13 +56,14 @@ def update_changelog(old_version, new_version, date):
    date_hyphen = date.replace("/", "-")
    with open(changelog_file, "r", encoding="utf-8") as f:
        changelog_content = f.read()
        body_index = changelog_content.index("<!-- BODY -->") + len("<!-- BODY -->")
        body_index = changelog_content.index("<!-- BODY") + len("<!-- BODY")
        next_newline_index = changelog_content.find("\n", body_index)
        new_entry = "\n" * 2 + generate_changelog_md(
            old_version, new_version, date_hyphen
        )
        print(new_entry)
        updated_content = (
            changelog_content[:body_index] + new_entry + changelog_content[body_index:]
            changelog_content[:next_newline_index] + new_entry + changelog_content[next_newline_index:]
        )
    with open(changelog_file, "w", encoding="utf-8") as f:
        f.write(updated_content)