Update release script to be compatible with macOS

BSD vs GNU `sed` problems:
```
sed -i '0,/^\$id: .*/s||$id: https://element-hq.github.io/synapse/schema/synapse/v1.157/synapse-config.schema.json|' schema/synapse-config.schema.yaml
sed: 1: "schema/synapse-config.s ...": bad flag in substitute command: 'h'
```
This commit is contained in:
Eric Eastwood
2026-07-14 16:14:35 -05:00
parent 1979fcca52
commit 651b44e0fc
+12 -1
View File
@@ -260,7 +260,18 @@ def _prepare() -> None:
schema_file = "schema/synapse-config.schema.yaml"
major_minor_version = ".".join(new_version.split(".")[:2])
url = f"https://element-hq.github.io/synapse/schema/synapse/v{major_minor_version}/synapse-config.schema.json"
subprocess.check_output(["sed", "-i", f"0,/^\\$id: .*/s||$id: {url}|", schema_file])
# Find/replace the `$id: ...` line in `schema/synapse-config.schema.yaml` with a new
# unique identifier for this release
#
# We use two `open(...)` blocks as it's easier to read/write then figure out the
# seek/truncate dance with one.
with open(schema_file) as f:
contents = f.read()
contents = re.sub(
r"^\$id: .*", f"$id: {url}", contents, count=1, flags=re.MULTILINE
)
with open(schema_file, "w") as f:
f.write(contents)
# Generate changelogs.
generate_and_write_changelog(synapse_repo, current_version, new_version)