[maven] Updates to maven automation
1. Drop RC and milestone releases by adopting a simple version regex. Drops a few non-stable releases from jreleaser and tomcat. Tested against all of the maven automated pages 2. Fix pages with multiple auto: maven entries. In particular, groovy was using this, but the newer 4.0 releases were not being written correctly to disk.
This commit is contained in:
32
src/maven.py
32
src/maven.py
@@ -5,7 +5,17 @@ import json
|
|||||||
import frontmatter
|
import frontmatter
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import datetime
|
import datetime
|
||||||
|
import re
|
||||||
|
|
||||||
|
# Major.Minor + Optional Patch, no RC, nightly releases.
|
||||||
|
VERSION_REGEX = r'^\d+\.\d+(\.\d+)?$'
|
||||||
|
|
||||||
|
# TODO: Add support for custom regexes
|
||||||
|
# Hasn't been needed yet, so only write if we need it
|
||||||
|
def valid_version(version):
|
||||||
|
if re.match(VERSION_REGEX, version):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def fetch_releases(package_identifier):
|
def fetch_releases(package_identifier):
|
||||||
group_id, artifact_id = package_identifier.split("/")
|
group_id, artifact_id = package_identifier.split("/")
|
||||||
@@ -21,10 +31,7 @@ def fetch_releases(package_identifier):
|
|||||||
for row in data["response"]["docs"]:
|
for row in data["response"]["docs"]:
|
||||||
date = datetime.datetime.utcfromtimestamp(row["timestamp"] / 1000)
|
date = datetime.datetime.utcfromtimestamp(row["timestamp"] / 1000)
|
||||||
version = row["v"]
|
version = row["v"]
|
||||||
if not any(
|
if valid_version(version):
|
||||||
exception in version
|
|
||||||
for exception in ["alpha", "beta", "nightly", "rc", "-M"]
|
|
||||||
):
|
|
||||||
abs_date = date.strftime("%Y-%m-%d")
|
abs_date = date.strftime("%Y-%m-%d")
|
||||||
releases[version] = abs_date
|
releases[version] = abs_date
|
||||||
print("%s: %s" % (version, abs_date))
|
print("%s: %s" % (version, abs_date))
|
||||||
@@ -40,20 +47,25 @@ def update_releases(product_filter=None):
|
|||||||
if product_filter and product_name != product_filter:
|
if product_filter and product_name != product_filter:
|
||||||
continue
|
continue
|
||||||
with open(product_file, "r") as f:
|
with open(product_file, "r") as f:
|
||||||
|
releases = {}
|
||||||
|
found_maven = False
|
||||||
|
print("::group::%s" % product_name)
|
||||||
data = frontmatter.load(f)
|
data = frontmatter.load(f)
|
||||||
if "auto" in data:
|
if "auto" in data:
|
||||||
for config in data["auto"]:
|
for config in data["auto"]:
|
||||||
for key, _ in config.items():
|
for key, _ in config.items():
|
||||||
if key == "maven":
|
if key == "maven":
|
||||||
update_product(product_name, config)
|
found_maven = True
|
||||||
|
releases = releases | fetch_releases(config["maven"])
|
||||||
|
if found_maven:
|
||||||
|
write_file(product_name, releases)
|
||||||
|
print("::endgroup::")
|
||||||
|
|
||||||
|
|
||||||
def update_product(product_name, config):
|
def write_file(product_name, releases):
|
||||||
print("::group::%s" % product_name)
|
|
||||||
r = fetch_releases(config["maven"])
|
|
||||||
with open("releases/%s.json" % product_name, "w") as f:
|
with open("releases/%s.json" % product_name, "w") as f:
|
||||||
f.write(json.dumps(r, indent=2))
|
f.write(json.dumps(releases, indent=2))
|
||||||
print("::endgroup::")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user