diff --git a/RELEASE.md b/RELEASE.md index a3fa907f01..a1aa9c6e10 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -13,7 +13,10 @@ - If necessary, add a note detailing any impact to externally facing APIs. 1. Update `packages/jaeger-ui/package.json#version` to refer to the version being released. 1. Create a GitHub release. - - The tag and release must refer to the commit created when the PR from the previous step was merged. - - The tag name for the GitHub release should be the version for the release. It should include the "v", e.g. `v1.0.0`. - - The title of the release match the format "Jaeger UI vX.Y.Z". - - Copy the new CHANGELOG.md section into the release notes. + - Automated (requires [gh](https://cli.github.com/manual/installation)): + - `python ./scripts/draft-release.py` + - Manual: + - The tag and release must refer to the commit created when the PR from the previous step was merged. + - The tag name for the GitHub release should be the version for the release. It should include the "v", e.g. `v1.0.0`. + - The title of the release match the format "Jaeger UI vX.Y.Z". + - Copy the new CHANGELOG.md section into the release notes. diff --git a/scripts/draft-release.py b/scripts/draft-release.py new file mode 100644 index 0000000000..af0b4c962d --- /dev/null +++ b/scripts/draft-release.py @@ -0,0 +1,47 @@ +import re +import subprocess + + +release_header_pattern = re.compile(r"## (v[\d]+\.[\d]+\.[\d]) \([\d]{4}-[\d]{2}-[\d]{2}\)", flags=0) + + +def main(): + changelog_text, version = get_changelog() + print(changelog_text) + output_string = subprocess.check_output( + ["gh", "release", "create", version, + "--draft", + "--title", f"Jaeger UI {version}", + "--repo", "jaegertracing/jaeger-ui", + "-F", "-"], + input=changelog_text, + text=True, + ) + print(f"Draft created at: {output_string}") + print("Please review, then edit it and click 'Publish release'.") + + +def get_changelog(): + changelog_text = "" + in_changelog_text = False + version = "" + with open("CHANGELOG.md") as f: + for line in f: + m = release_header_pattern.match(line) + + if m is not None: + # Found the first release. + if not in_changelog_text: + in_changelog_text = True + version = m.group(1) + else: + # Found the next release. + break + elif in_changelog_text: + changelog_text += line + + return changelog_text, version + + +if __name__ == "__main__": + main()