mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 00:46:31 +03:00
Backport new set_core_version.py
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import datetime
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
@@ -56,7 +57,8 @@ def update_package_json(relpath, newversion):
|
|||||||
json_data = json.loads(f.read())
|
json_data = json.loads(f.read())
|
||||||
json_data["version"] = newversion
|
json_data["version"] = newversion
|
||||||
with open(p, "w") as f:
|
with open(p, "w") as f:
|
||||||
f.write(json.dumps(json_data, sort_keys=True, indent=2))
|
json.dump(json_data, f, sort_keys=True, indent=2)
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -90,15 +92,25 @@ def main():
|
|||||||
ffi_toml = read_toml_version("deltachat-ffi/Cargo.toml")
|
ffi_toml = read_toml_version("deltachat-ffi/Cargo.toml")
|
||||||
assert core_toml == ffi_toml, (core_toml, ffi_toml)
|
assert core_toml == ffi_toml, (core_toml, ffi_toml)
|
||||||
|
|
||||||
|
today = datetime.date.today().isoformat()
|
||||||
|
|
||||||
if "alpha" not in newversion:
|
if "alpha" not in newversion:
|
||||||
for line in open("CHANGELOG.md"):
|
changelog_name = "CHANGELOG.md"
|
||||||
|
changelog_tmpname = changelog_name + ".tmp"
|
||||||
|
changelog_tmp = open(changelog_tmpname, "w")
|
||||||
|
found = False
|
||||||
|
for line in open(changelog_name):
|
||||||
## 1.25.0
|
## 1.25.0
|
||||||
if line.startswith("## [") and line[4:].strip().startswith(newversion):
|
if line == f"## [{newversion}]\n":
|
||||||
break
|
line = f"## [{newversion}] - {today}\n"
|
||||||
else:
|
found = True
|
||||||
|
changelog_tmp.write(line)
|
||||||
|
if not found:
|
||||||
raise SystemExit(
|
raise SystemExit(
|
||||||
f"CHANGELOG.md contains no entry for version: {newversion}"
|
f"{changelog_name} contains no entry for version: {newversion}"
|
||||||
)
|
)
|
||||||
|
changelog_tmp.close()
|
||||||
|
os.rename(changelog_tmpname, changelog_name)
|
||||||
|
|
||||||
for toml_filename in toml_list:
|
for toml_filename in toml_list:
|
||||||
replace_toml_version(toml_filename, newversion)
|
replace_toml_version(toml_filename, newversion)
|
||||||
@@ -106,6 +118,9 @@ def main():
|
|||||||
for json_filename in json_list:
|
for json_filename in json_list:
|
||||||
update_package_json(json_filename, newversion)
|
update_package_json(json_filename, newversion)
|
||||||
|
|
||||||
|
with open("release-date.in", "w") as f:
|
||||||
|
f.write(today)
|
||||||
|
|
||||||
print("running cargo check")
|
print("running cargo check")
|
||||||
subprocess.call(["cargo", "check"])
|
subprocess.call(["cargo", "check"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user