From fc9b6d8e48fe2e475b90c1b6063dab512bb2a2dc Mon Sep 17 00:00:00 2001 From: minchulahn Date: Thu, 22 Jun 2023 15:48:56 +0900 Subject: [PATCH] Change file name --- main.py | 27 --------------------------- requirements.txt | 4 +--- markdown-table.py => update_readme.py | 0 update_version.py | 26 ++++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 30 deletions(-) delete mode 100644 main.py rename markdown-table.py => update_readme.py (100%) create mode 100644 update_version.py diff --git a/main.py b/main.py deleted file mode 100644 index 86a8927..0000000 --- a/main.py +++ /dev/null @@ -1,27 +0,0 @@ -import json, sys, traceback - -def get_service_index(): - for index, value in enumerate(json_data['service']): - if(value['name'] == serviceName): - return index - exit(traceback.print_exc()) - -def set_latest_version(): - service_index = get_service_index() - json_data["service"][service_index]["latest_candidate_version"] = releaseTag - -if __name__ == '__main__': - if len(sys.argv) != 3: - exit(traceback.print_exc()) - - releaseTag = sys.argv[1] - serviceName = sys.argv[2] - file_path = "./version.json" - - with open(file_path, 'r') as json_file: - json_data = json.load(json_file) - - set_latest_version() - - with open(file_path, 'w') as file: - json.dump(json_data, file, indent=4) diff --git a/requirements.txt b/requirements.txt index 3cdbf83..b510a9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,2 @@ jsontemplates==0.1.0 -PyYAML==6.0 -pandas==2.0.2 -tabulate==0.9.0 \ No newline at end of file +PyYAML==6.0 \ No newline at end of file diff --git a/markdown-table.py b/update_readme.py similarity index 100% rename from markdown-table.py rename to update_readme.py diff --git a/update_version.py b/update_version.py new file mode 100644 index 0000000..62aaf09 --- /dev/null +++ b/update_version.py @@ -0,0 +1,26 @@ +import json, sys, traceback + +if len(sys.argv) != 3: + exit(traceback.print_exc()) + +def get_service_index(): + for index, value in enumerate(json_data['service']): + if(value['name'] == serviceName): + return index + exit(traceback.print_exc()) + +def set_latest_version(): + service_index = get_service_index() + json_data["service"][service_index]["latest_candidate_version"] = releaseTag + +releaseTag = sys.argv[1] +serviceName = sys.argv[2] +file_path = "./version.json" + +with open(file_path, 'r') as json_file: + json_data = json.load(json_file) + +set_latest_version() + +with open(file_path, 'w') as file: + json.dump(json_data, file, indent=4)