mirror of
https://github.com/element-hq/synapse.git
synced 2026-07-23 00:02:20 +00:00
Update release script JSON schema find/replace to be compatible with macOS (#19962)
BSD vs GNU `sed` problems: ```shell $ 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:
@@ -0,0 +1 @@
|
||||
Update release script JSON schema find/replace task to be compatible with macOS.
|
||||
@@ -31,6 +31,7 @@ import sys
|
||||
import time
|
||||
import urllib.request
|
||||
from os import path
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
from typing import Any
|
||||
|
||||
@@ -257,10 +258,16 @@ def _prepare() -> None:
|
||||
subprocess.check_output(["poetry", "version", new_version])
|
||||
|
||||
# Update config schema $id.
|
||||
schema_file = "schema/synapse-config.schema.yaml"
|
||||
schema_file_path = Path("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
|
||||
schema_file_content = schema_file_path.read_text()
|
||||
new_schema_file_content = re.sub(
|
||||
r"^\$id: .*", f"$id: {url}", schema_file_content, count=1, flags=re.MULTILINE
|
||||
)
|
||||
schema_file_path.write_text(new_schema_file_content)
|
||||
|
||||
# Generate changelogs.
|
||||
generate_and_write_changelog(synapse_repo, current_version, new_version)
|
||||
|
||||
Reference in New Issue
Block a user