mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 07:32:12 +03:00
don't ignore core sourcefiles, prevented npm installation on architectures with no prebuild don't run lint checks on windows github actions don't like double quotes apparently minimize node.js CI update ubuntu runner to 22.04 README: update link to node bindings source simplify link in readme node: fix crash with invalid account id (throw error when getContext failed) fix typo in readme remove node specific changelog change prebuild machine back to ubuntu 18.04 move package.json to root level to include rust source in npm package change path in m1 patch github action to upload to download.delta.chat/node/ on tag try build with ubuntu 20.04 Update node/README.md try building it with newer ubuntu because it wants glibc 2.33 fix path for prebuildify script throw error when instanciating a wrapper class on `null` (Context, Message, Chat, ChatList and so on) try fix selecting the right cache to fix the strange glibc bug also revert back ubuntu version to 18.04 also bump package.json version with release script fix paths since we moved around package.json github action: fix path document npm release - it's so much easier now! there are no PR checks to post to if this action is executed on a tag github action: fix artifact names fix paths? wtf do I know, it's 3AM and I'm drunk fix syntax error don't upload preview if action is run on tag is the tag ID an empty string or null? node-package github action is done so far also include scripts in package only publish docs on push to master branch actually bump package.json version in set_core_version script prettify package.json fix test - we don't really need to assert that remove unnecessary ls statement from github action
117 lines
3.3 KiB
Python
117 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import json
|
|
import re
|
|
import pathlib
|
|
import subprocess
|
|
from argparse import ArgumentParser
|
|
|
|
rex = re.compile(r'version = "(\S+)"')
|
|
|
|
|
|
def regex_matches(relpath, regex=rex):
|
|
p = pathlib.Path(relpath)
|
|
assert p.exists()
|
|
for line in open(str(p)):
|
|
m = regex.match(line)
|
|
if m is not None:
|
|
return m
|
|
|
|
|
|
def read_toml_version(relpath):
|
|
res = regex_matches(relpath, rex)
|
|
if res is not None:
|
|
return res.group(1)
|
|
raise ValueError("no version found in {}".format(relpath))
|
|
|
|
|
|
def replace_toml_version(relpath, newversion):
|
|
p = pathlib.Path(relpath)
|
|
assert p.exists()
|
|
tmp_path = str(p) + "_tmp"
|
|
with open(tmp_path, "w") as f:
|
|
for line in open(str(p)):
|
|
m = rex.match(line)
|
|
if m is not None:
|
|
print("{}: set version={}".format(relpath, newversion))
|
|
f.write('version = "{}"\n'.format(newversion))
|
|
else:
|
|
f.write(line)
|
|
os.rename(tmp_path, str(p))
|
|
|
|
|
|
def read_json_version(relpath):
|
|
p = pathlib.Path("package.json")
|
|
assert p.exists()
|
|
with open(p, "r") as f:
|
|
json_data = json.loads(f.read())
|
|
return json_data["version"]
|
|
|
|
|
|
def update_package_json(newversion):
|
|
p = pathlib.Path("package.json")
|
|
assert p.exists()
|
|
with open(p, "r") as f:
|
|
json_data = json.loads(f.read())
|
|
json_data["version"] = newversion
|
|
with open(p, "w") as f:
|
|
f.write(json.dumps(json_data, sort_keys=True, indent=2))
|
|
|
|
|
|
def main():
|
|
parser = ArgumentParser(prog="set_core_version")
|
|
parser.add_argument("newversion")
|
|
|
|
toml_list = ["Cargo.toml", "deltachat-ffi/Cargo.toml"]
|
|
try:
|
|
opts = parser.parse_args()
|
|
except SystemExit:
|
|
print()
|
|
for x in toml_list:
|
|
print("{}: {}".format(x, read_toml_version(x)))
|
|
print("package.json:", str(read_json_version("package.json")))
|
|
print()
|
|
raise SystemExit("need argument: new version, example: 1.25.0")
|
|
|
|
newversion = opts.newversion
|
|
if newversion.count(".") < 2:
|
|
raise SystemExit("need at least two dots in version")
|
|
|
|
core_toml = read_toml_version("Cargo.toml")
|
|
ffi_toml = read_toml_version("deltachat-ffi/Cargo.toml")
|
|
assert core_toml == ffi_toml, (core_toml, ffi_toml)
|
|
|
|
if "alpha" not in newversion:
|
|
for line in open("CHANGELOG.md"):
|
|
## 1.25.0
|
|
if line.startswith("## "):
|
|
if line[2:].strip().startswith(newversion):
|
|
break
|
|
else:
|
|
raise SystemExit("CHANGELOG.md contains no entry for version: {}".format(newversion))
|
|
|
|
replace_toml_version("Cargo.toml", newversion)
|
|
replace_toml_version("deltachat-ffi/Cargo.toml", newversion)
|
|
update_package_json(newversion)
|
|
|
|
print("running cargo check")
|
|
subprocess.call(["cargo", "check"])
|
|
|
|
print("adding changes to git index")
|
|
subprocess.call(["git", "add", "-u"])
|
|
# subprocess.call(["cargo", "update", "-p", "deltachat"])
|
|
|
|
print("after commit, on master make sure to: ")
|
|
print("")
|
|
print(" git tag -a {}".format(newversion))
|
|
print(" git push origin {}".format(newversion))
|
|
print(" git tag -a py-{}".format(newversion))
|
|
print(" git push origin py-{}".format(newversion))
|
|
print("")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|