From 333ab34a2d5f8c8639ee46b7c69b2b9372b78371 Mon Sep 17 00:00:00 2001 From: minchulahn Date: Thu, 22 Jun 2023 11:00:49 +0900 Subject: [PATCH] Add readme.md File Generation Code --- main.py | 1 - markdown-table.py | 13 +++++++++++++ requirements.txt | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 markdown-table.py diff --git a/main.py b/main.py index a4fbd6d..86a8927 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,6 @@ def set_latest_version(): if __name__ == '__main__': if len(sys.argv) != 3: exit(traceback.print_exc()) - releaseTag = sys.argv[1] serviceName = sys.argv[2] diff --git a/markdown-table.py b/markdown-table.py new file mode 100644 index 0000000..8e1c7fa --- /dev/null +++ b/markdown-table.py @@ -0,0 +1,13 @@ +import json, pandas + +version_file_path= "./version.json" +readme_file_path= "./README.md" + +data = json.load(open(version_file_path, 'r')) + +df = pandas.DataFrame.from_dict(data['service']).rename(columns={'type':'Type', 'name':'Name', 'candidate_version':'Candidate Version', 'release_version':'Release Version', 'product_version':'Product Version'}) +df.drop(['latest_candidate_version'], axis=1, inplace=True) + +with open(readme_file_path, 'w') as file: + file.write("# DataSaker\n### {}\n\n".format(data["datasaker"])) + file.write("# Service Version\n{}".format(df.to_markdown(index=False))) diff --git a/requirements.txt b/requirements.txt index b510a9e..77e5c24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ jsontemplates==0.1.0 -PyYAML==6.0 \ No newline at end of file +PyYAML==6.0 +pandas==2.0.2 \ No newline at end of file