build(release): support 13.6.1 v22 and RN 11.5.0 version lock

This commit is contained in:
tei
2026-10-09 14:07:18 +09:00
parent 69922b795a
commit 40b79764ae
3 changed files with 42 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ def main() -> None:
"name": "@navsea/maplibre-particle-rn",
"version": android_version,
"artifact": tgz,
"mapLibreReactNative": "11.3.6",
"mapLibreReactNative": json.loads((ROOT / "packages/maplibre-particle-rn/package.json").read_text())["peerDependencies"]["@maplibre/maplibre-react-native"],
},
"android": {
"version": android_version,

View File

@@ -20,14 +20,20 @@ def base_version(value: str) -> str:
return re.sub(r"-particle\.\d+$", "", value.strip())
def replace_current_particle(path: Path, base: str, target: str) -> None:
def replace_current_particle(path: Path, previous: str, target: str) -> None:
text = path.read_text()
pattern = rf"{re.escape(base)}-particle\.\d+"
updated, count = re.subn(pattern, target, text)
updated, count = re.subn(re.escape(previous), target, text)
if count == 0:
die(f"no particle version reference found in {path}")
die(f"previous RN/Native version {previous} not found in {path}")
path.write_text(updated)
def replace_exact(path: Path, old: str, new: str) -> None:
text = path.read_text()
if text.count(old) != 1:
die(f"expected exactly one version reference {old!r} in {path}")
path.write_text(text.replace(old, new, 1))
def update_changelog(target: str, revision: int) -> None:
path = RN_ROOT / "CHANGELOG.md"
text = path.read_text()
@@ -64,7 +70,11 @@ def main() -> None:
package_path = RN_ROOT / "package.json"
package = json.loads(package_path.read_text())
previous_rn_version = package["version"]
package["version"] = android_version
# v22 upgrades the host MapLibre React Native baseline together with native.
package["peerDependencies"]["@maplibre/maplibre-react-native"] = "11.5.0"
package["devDependencies"]["@maplibre/maplibre-react-native"] = "11.5.0"
package_path.write_text(json.dumps(package, ensure_ascii=False, indent=2) + "\n")
for relative in (
@@ -72,15 +82,14 @@ def main() -> None:
"packages/maplibre-particle-rn/app.plugin.js",
"integration/react-native/MapLibreParticleRNTestHost/plugins/withParticleNativeAndroid.js",
):
replace_current_particle(ROOT / relative, android_base, android_version)
replace_current_particle(ROOT / relative, previous_rn_version, android_version)
readme = RN_ROOT / "README.md"
readme_text = readme.read_text()
readme_text = re.sub(
rf"{re.escape(android_base)}-particle\.\d+",
android_version,
readme_text,
)
if previous_rn_version not in readme_text:
die("README missing previous RN version")
readme_text = readme_text.replace(previous_rn_version, android_version)
readme_text = readme_text.replace("11.3.6", "11.5.0")
readme_text = re.sub(
r"必须指向同一 `\.\d+`",
f"必须指向同一 `.{revision}`",
@@ -88,6 +97,26 @@ def main() -> None:
)
readme.write_text(readme_text)
# Both Expo plugins must request the same upstream Native base as the new AAR.
for relative in (
"packages/maplibre-particle-rn/app.plugin.js",
"integration/react-native/MapLibreParticleRNTestHost/plugins/withParticleNativeAndroid.js",
):
replace_exact(ROOT / relative,
'nativeVersion", "13.4.1"',
f'nativeVersion", "{android_base}"')
podspec = RN_ROOT / "MapLibreParticleRN.podspec"
podtext = podspec.read_text()
if podtext.count('11.3.6') != 2:
die("podspec must contain exactly two pinned RN 11.3.6 references")
podspec.write_text(podtext.replace("11.3.6", "11.5.0"))
host_path = ROOT / "integration/react-native/MapLibreParticleRNTestHost/package.json"
host = json.loads(host_path.read_text())
host["dependencies"]["@maplibre/maplibre-react-native"] = "11.5.0"
host_path.write_text(json.dumps(host, ensure_ascii=False, indent=2) + "\n")
update_changelog(android_version, revision)
print(f"PARTICLE_REVISION={revision}")

View File

@@ -73,6 +73,8 @@ prepare_release() {
packages/maplibre-particle-rn/app.plugin.js \
packages/maplibre-particle-rn/README.md \
packages/maplibre-particle-rn/CHANGELOG.md \
packages/maplibre-particle-rn/MapLibreParticleRN.podspec \
integration/react-native/MapLibreParticleRNTestHost/package.json \
integration/react-native/MapLibreParticleRNTestHost/plugins/withParticleNativeAndroid.js
if ! git -C "$ROOT" diff --cached --quiet; then
git -C "$ROOT" commit -m "release: prepare unified particle.$REV"