Support releasing on macOS. (#16266)

pull/16324/head
Patrick Cloke 2023-09-07 07:00:41 -04:00 committed by GitHub
parent fd50a9b47c
commit 7e98d382f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 16 deletions

1
changelog.d/16266.misc Normal file
View File

@ -0,0 +1 @@
Update the release script to work on macOS.

View File

@ -244,11 +244,17 @@ def _prepare() -> None:
else: else:
debian_version = new_version debian_version = new_version
run_until_successful( if sys.platform == "darwin":
f'dch -M -v {debian_version} "New Synapse release {new_version}."', run_until_successful(
shell=True, f"docker run --rm -v .:/synapse ubuntu:latest /synapse/scripts-dev/docker_update_debian_changelog.sh {new_version}",
) shell=True,
run_until_successful('dch -M -r -D stable ""', shell=True) )
else:
run_until_successful(
f'dch -M -v {debian_version} "New Synapse release {new_version}."',
shell=True,
)
run_until_successful('dch -M -r -D stable ""', shell=True)
# Show the user the changes and ask if they want to edit the change log. # Show the user the changes and ask if they want to edit the change log.
synapse_repo.git.add("-u") synapse_repo.git.add("-u")
@ -566,19 +572,27 @@ def _notify(message: str) -> None:
# for this. # for this.
click.echo(f"\a{message}") click.echo(f"\a{message}")
app_name = "Synapse Release Script"
# Try and run notify-send, but don't raise an Exception if this fails # Try and run notify-send, but don't raise an Exception if this fails
# (This is best-effort) # (This is best-effort)
# TODO Support other platforms? if sys.platform == "darwin":
subprocess.run( # See https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW224
[ subprocess.run(
"notify-send", f"""osascript -e 'display notification "{message}" with title "{app_name}"'""",
"--app-name", shell=True,
"Synapse Release Script", )
"--expire-time", else:
"3600000", subprocess.run(
message, [
] "notify-send",
) "--app-name",
app_name,
"--expire-time",
"3600000",
message,
]
)
@cli.command() @cli.command()