diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-08-27 23:19:38 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-08-27 23:19:38 +0200 |
commit | 48504e3e4d8a24cf4f42a07e472e4a6c40393bc6 (patch) | |
tree | e82f9ebfdce540d45bfce129563cbaf7b6d78a17 /scripts | |
parent | f01751c3a9ada9ce3495b58cb4e0ce93a95be427 (diff) | |
download | FlightCore-48504e3e4d8a24cf4f42a07e472e4a6c40393bc6.tar.gz FlightCore-48504e3e4d8a24cf4f42a07e472e4a6c40393bc6.zip |
Publish release file as releasev0.0.5
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/check_version_numbers.py | 24 | ||||
-rw-r--r-- | scripts/create-release-file.py | 44 |
2 files changed, 68 insertions, 0 deletions
diff --git a/scripts/check_version_numbers.py b/scripts/check_version_numbers.py new file mode 100644 index 00000000..4b8d0fe8 --- /dev/null +++ b/scripts/check_version_numbers.py @@ -0,0 +1,24 @@ +# %% +""""Ensure that version numbers between `tauri.conf.json`, `cargo.toml`, and GitHub release are the same""" +import json +import toml +import sys + +with open("src-tauri/tauri.conf.json", "rt") as f: + tauri_conf_json = json.load(f) + +with open("src-tauri/Cargo.toml", "rt") as f: + Cargo_toml = toml.load(f) + +tauri_conf_json_version = tauri_conf_json["package"]["version"] +Cargo_toml_version = Cargo_toml["package"]["version"] + +# Ensure same +assert(tauri_conf_json_version == Cargo_toml_version) + +# Check release tag additionally if release +if "--release" in sys.argv: + print("TODO") + release_tag = sys.argv[2] + print(release_tag) + assert(release_tag == f"v{tauri_conf_json_version}") diff --git a/scripts/create-release-file.py b/scripts/create-release-file.py new file mode 100644 index 00000000..1c364d90 --- /dev/null +++ b/scripts/create-release-file.py @@ -0,0 +1,44 @@ +# %% +import json +import datetime +import sys + +assert("--version" in sys.argv) + +version_number = sys.argv[2] +version_number_stripped_v = version_number.replace("v", "") + +PATH_TO_LINUX_SIG = f"./artifact/appimage/flightcore_{version_number_stripped_v}_amd64.AppImage.tar.gz.sig" +PATH_TO_WINDOWS_SIG = f"./artifact/msi/flightcore_{version_number_stripped_v}_x64_en-US.msi.zip.sig" + +# Read signatures +with open(PATH_TO_LINUX_SIG, "rt") as f: + linux_sig = f.read() +with open(PATH_TO_WINDOWS_SIG, "rt") as f: + windows_sig = f.read() + + +current_datetime_string = str(datetime.datetime.utcnow().replace(microsecond=0).isoformat() + "Z") + +release_dict = { + "version": f"{version_number}", + "notes": "Test version", + "pub_date": current_datetime_string, + "platforms": { + "linux-x86_64": { + "signature": linux_sig, + "url": f"https://github.com/GeckoEidechse/FlightCore/releases/download/{version_number}/flightcore_{version_number_stripped_v}_amd64.AppImage.tar.gz" + }, + "windows-x86_64": { + "signature": windows_sig, + "url": f"https://github.com/GeckoEidechse/FlightCore/releases/download/{version_number}/flightcore_{version_number_stripped_v}_x64_en-US.msi.zip" + } + } +} +json_string = json.dumps(release_dict, indent=4) +print(json_string) +# %% +RESULT_JSON_FILENAME = "latest-release.json" +with open(RESULT_JSON_FILENAME, "wt") as f: + f.write(json_string) +# %% |