29 lines
785 B
Python
29 lines
785 B
Python
import json, sys, traceback
|
|
|
|
def get_service_index():
|
|
for index, value in enumerate(json_data['service']):
|
|
if(value['name'] == service_name):
|
|
return index
|
|
exit(traceback.print_exc())
|
|
|
|
def set_latest_version():
|
|
service_index = get_service_index()
|
|
json_data["service"][service_index]["set_latest_version"] = tagName
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(sys.argv) != 3 or 'rc' not in sys.argv[1]:
|
|
exit(traceback.print_exc())
|
|
|
|
tagName = sys.argv[1]
|
|
service_name = sys.argv[2]
|
|
file_path = "./rc-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)
|