浏览代码

Make release script write correct no-op changelog (#12127)

As we want to include the previous version in the "No new changes..."
string.
tags/v1.54.0
Erik Johnston 2 年前
committed by GitHub
父节点
当前提交
6d282a9c89
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 29 次插入2 次删除
  1. +1
    -0
      changelog.d/12127.misc
  2. +28
    -2
      scripts-dev/release.py

+ 1
- 0
changelog.d/12127.misc 查看文件

@@ -0,0 +1 @@
Update release script to insert the previous version when writing "No significant changes" line in the changelog.

+ 28
- 2
scripts-dev/release.py 查看文件

@@ -17,6 +17,8 @@
"""An interactive script for doing a release. See `cli()` below.
"""

import glob
import os
import re
import subprocess
import sys
@@ -209,8 +211,8 @@ def prepare():
with open("synapse/__init__.py", "w") as f:
f.write(parsed_synapse_ast.dumps())

# Generate changelogs
run_until_successful("python3 -m towncrier", shell=True)
# Generate changelogs.
generate_and_write_changelog(current_version)

# Generate debian changelogs
if parsed_new_version.pre is not None:
@@ -523,5 +525,29 @@ def get_changes_for_version(wanted_version: version.Version) -> str:
return "\n".join(version_changelog)


def generate_and_write_changelog(current_version: version.Version):
# We do this by getting a draft so that we can edit it before writing to the
# changelog.
result = run_until_successful(
"python3 -m towncrier --draft", shell=True, capture_output=True
)
new_changes = result.stdout.decode("utf-8")
new_changes = new_changes.replace(
"No significant changes.", f"No significant changes since {current_version}."
)

# Prepend changes to changelog
with open("CHANGES.md", "r+") as f:
existing_content = f.read()
f.seek(0, 0)
f.write(new_changes)
f.write("\n")
f.write(existing_content)

# Remove all the news fragments
for f in glob.iglob("changelog.d/*.*"):
os.remove(f)


if __name__ == "__main__":
cli()

正在加载...
取消
保存