Refactor product releases writing
Create a common function to write resulting JSON files to the releases directory. It makes this task simpler to read and maintain, while making it modifiable at a central point in the future. One example of such modification could be the sorting of the versions in a uniform way for all the scripts.
This commit is contained in:
10
src/rds.py
10
src/rds.py
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
import re
|
||||
from bs4 import BeautifulSoup
|
||||
from common import endoflife
|
||||
@@ -36,9 +35,8 @@ for db, url in dbs.items():
|
||||
print(f"{version} : {date}")
|
||||
releases[version] = date
|
||||
|
||||
endoflife.write_releases(f"amazon-rds-{db.lower()}", dict(
|
||||
# sort by date then version (desc)
|
||||
sorted(releases.items(), key=lambda x: (x[1], x[0]), reverse=True)
|
||||
))
|
||||
print("::endgroup::")
|
||||
with open(f"releases/amazon-rds-{db.lower()}.json", "w") as f:
|
||||
json.dump(dict(
|
||||
# sort by date then version (desc)
|
||||
sorted(releases.items(), key=lambda x: (x[1], x[0]), reverse=True)
|
||||
), f, indent=2)
|
||||
|
||||
Reference in New Issue
Block a user