Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Support releasing on macOS. (#16266)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Sep 7, 2023
1 parent fd50a9b commit 7e98d38
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions changelog.d/16266.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the release script to work on macOS.
46 changes: 30 additions & 16 deletions scripts-dev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,17 @@ def _prepare() -> None:
else:
debian_version = new_version

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)
if sys.platform == "darwin":
run_until_successful(
f"docker run --rm -v .:/synapse ubuntu:latest /synapse/scripts-dev/docker_update_debian_changelog.sh {new_version}",
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.
synapse_repo.git.add("-u")
Expand Down Expand Up @@ -566,19 +572,27 @@ def _notify(message: str) -> None:
# for this.
click.echo(f"\a{message}")

app_name = "Synapse Release Script"

# Try and run notify-send, but don't raise an Exception if this fails
# (This is best-effort)
# TODO Support other platforms?
subprocess.run(
[
"notify-send",
"--app-name",
"Synapse Release Script",
"--expire-time",
"3600000",
message,
]
)
if sys.platform == "darwin":
# See https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW224
subprocess.run(
f"""osascript -e 'display notification "{message}" with title "{app_name}"'""",
shell=True,
)
else:
subprocess.run(
[
"notify-send",
"--app-name",
app_name,
"--expire-time",
"3600000",
message,
]
)


@cli.command()
Expand Down

0 comments on commit 7e98d38

Please sign in to comment.