From f49611d274076a8e7908ebead84b26089d2f0737 Mon Sep 17 00:00:00 2001 From: Duco Sebel <74970928+DCSBL@users.noreply.github.com> Date: Thu, 12 Aug 2021 22:53:03 +0200 Subject: [PATCH] Create update_manifest.py --- .github/helpers/update_manifest.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/helpers/update_manifest.py diff --git a/.github/helpers/update_manifest.py b/.github/helpers/update_manifest.py new file mode 100644 index 0000000..abbe2f5 --- /dev/null +++ b/.github/helpers/update_manifest.py @@ -0,0 +1,27 @@ +"""Update the manifest file.""" +"""Idea from https://github.com/hacs/integration/blob/main/manage/update_manifest.py""" + +import sys +import json +import os + + +def update_manifest(): + """Update the manifest file.""" + version = "0.0.0" + for index, value in enumerate(sys.argv): + if value in ["--version", "-V"]: + version = sys.argv[index + 1] + + with open(f"{os.getcwd()}/custom_components/homewizard_energy/manifest.json") as manifestfile: + manifest = json.load(manifestfile) + + manifest["version"] = version + + with open( + f"{os.getcwd()}/custom_components/homewizard_energy/manifest.json", "w" + ) as manifestfile: + manifestfile.write(json.dumps(manifest, indent=4, sort_keys=True)) + + +update_manifest()