Skip to content

Commit

Permalink
更新发布脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
liziwl committed May 2, 2024
1 parent 378535d commit 02a92eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions test/update-dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def generate_changelog_md(old_version, new_version, date):
- 这里可以添加具体的修复内容,根据实际情况调整。
### Removed
- 这里可以添加具体的修复内容,根据实际情况调整。
"""
- 这里可以添加具体的修复内容,根据实际情况调整。"""

return md_template

Expand All @@ -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)
Expand Down

0 comments on commit 02a92eb

Please sign in to comment.