Add Java automation

Fetch Java versions with their dates from https://www.java.com/releases/.

This script is using a new dependency: requests-html (https://requests-html.kennethreitz.org/). This is because https://www.java.com/releases/ needs JavaScript to render correctly. And for this to work requests-html automatically downloads Chromium because of its dependency to pyppeteer.

Chromium is downloaded into PYPPETEER_HOME, so the workflow has been modified to set this directory as a subdirectory of ~/.cache. Note that declaring the same environment variable from the python script does not work.
This commit is contained in:
Marc Wrobel
2023-01-02 21:34:37 +01:00
parent a061e41789
commit 082b165d5d
4 changed files with 285 additions and 0 deletions

View File

@@ -58,6 +58,11 @@ jobs:
git config --global extensions.partialClone true
pip install -r requirements.txt
- name: Custom Updates
env:
# Add chromium downloaded by pyppeteer to the cache. See java.py for more information.
# Note that using we had to use /home/runner because using ~ does not work, despite what's
# explained in the https://github.com/actions/upload-artifact/tree/v2-preview#environment-variables-and-tilde-expansion.
PYPPETEER_HOME: /home/runner/.cache/pyppeteer
run: for i in src/*.py; do python $i;done
- name: Git and DockerHub Updates
run: bundle exec ruby update.rb ./website ~/.cache releases

228
releases/java.json Normal file
View File

@@ -0,0 +1,228 @@
{
"19.0.1": "2022-10-18",
"17.0.5": "2022-10-18",
"11.0.17": "2022-10-18",
"8u351": "2022-10-18",
"18.0.2.1": "2022-08-18",
"17.0.4.1": "2022-08-18",
"11.0.16.1": "2022-08-18",
"18.0.1.1": "2022-05-02",
"17.0.3.1": "2022-05-02",
"11.0.15.1": "2022-05-02",
"8u333": "2022-05-02",
"7u343": "2022-05-02",
"18": "2022-03-22",
"17.0.1": "2021-10-19",
"11.0.13": "2021-10-19",
"8u311": "2021-10-19",
"7u321": "2021-10-19",
"16.0.2": "2021-07-20",
"11.0.12": "2021-07-20",
"8u301": "2021-07-20",
"7u311": "2021-07-20",
"16": "2021-03-16",
"15.0.1": "2020-10-20",
"11.0.9": "2020-10-20",
"8u271": "2020-10-20",
"7u281": "2020-10-20",
"14.0.2": "2020-07-14",
"11.0.8": "2020-07-14",
"8u261": "2020-07-14",
"8u260": "2020-07-14",
"7u271": "2020-07-14",
"14": "2020-03-17",
"13.0.1": "2019-10-15",
"11.0.5": "2019-10-15",
"8u231": "2019-10-15",
"7u241": "2019-10-15",
"12.0.2": "2019-07-16",
"11.0.4": "2019-07-16",
"8u221": "2019-07-16",
"7u231": "2019-07-16",
"12": "2019-03-19",
"11.0.1": "2018-10-16",
"8u192": "2018-10-16",
"8u191": "2018-10-16",
"7u201": "2018-10-16",
"6u211": "2018-10-16",
"10.0.2": "2018-07-17",
"8u181": "2018-07-17",
"7u191": "2018-07-17",
"6u201": "2018-07-17",
"10": "2018-03-20",
"9.0.1": "2017-10-17",
"8u152": "2017-10-17",
"8u151": "2017-10-17",
"7u161": "2017-10-17",
"6u171": "2017-10-17",
"8u144": "2017-07-26",
"8u131": "2017-04-18",
"7u141": "2017-04-18",
"6u151": "2017-04-18",
"8u112": "2016-10-18",
"8u111": "2016-10-18",
"7u121": "2016-10-18",
"6u131": "2016-10-18",
"8u92": "2016-04-19",
"8u91": "2016-04-19",
"7u101": "2016-04-19",
"6u115": "2016-04-19",
"8u74": "2016-02-05",
"8u73": "2016-02-05",
"7u97": "2016-02-05",
"6u113": "2016-02-05",
"8u66": "2015-10-20",
"8u65": "2015-10-20",
"7u91": "2015-10-20",
"6u105": "2015-10-20",
"8u51": "2015-07-14",
"7u85": "2015-07-14",
"6u101": "2015-07-14",
"8u40": "2015-03-03",
"8u25": "2014-10-14",
"7u72": "2014-10-14",
"7u71": "2014-10-14",
"6u85": "2014-10-14",
"5.0u75": "2014-10-14",
"7u67": "2014-08-04",
"7u60": "2014-05-28",
"8": "2014-03-18",
"7u45": "2013-10-15",
"6u65": "2013-10-15",
"5.0u55": "2013-10-15",
"7u25": "2013-06-18",
"6u51": "2013-06-18",
"5.0u51": "2013-06-18",
"7u17": "2013-03-04",
"6u43": "2013-03-04",
"5.0u41": "2013-03-04",
"7u13": "2013-02-01",
"6u39": "2013-02-01",
"5.0u39": "2013-02-01",
"1.4.2_41": "2013-02-01",
"7u10": "2012-12-11",
"6u38": "2012-12-11",
"7u7": "2012-08-30",
"6u35": "2012-08-30",
"7u5": "2012-06-12",
"6u33": "2012-06-12",
"5.0u36": "2012-06-12",
"1.4.2_38": "2012-06-12",
"7u3": "2012-02-14",
"6u31": "2012-02-14",
"5.0u34": "2012-02-14",
"1.4.2_36": "2012-02-14",
"7u1": "2011-10-18",
"6u29": "2011-10-18",
"5.0u32": "2011-10-18",
"1.4.2_34": "2011-10-18",
"1.3.1_32": "2011-10-18",
"7": "2011-07-11",
"6u25": "2011-04-21",
"5.0u29": "2011-04-21",
"1.4.2_31": "2011-04-21",
"5.0u27": "2010-12-13",
"1.4.2_29": "2010-12-13",
"6u22m": "2010-10-18",
"6u21p": "2010-09-23",
"6u20": "2010-04-15",
"6u18": "2010-01-13",
"5.0u23": "2010-01-13",
"1.4.2_25": "2010-01-13",
"5.0u21": "2009-09-07",
"1.4.2_23": "2009-09-07",
"6u15": "2009-08-04",
"5.0u20": "2009-08-04",
"1.4.2_22": "2009-08-04",
"1.3.1_26": "2009-08-04",
"6u14": "2009-05-28",
"6u13": "2009-03-24",
"5.0u18": "2009-03-24",
"1.4.2_20": "2009-03-24",
"1.3.1_25": "2009-03-24",
"6u11": "2008-12-02",
"5.0u17": "2008-12-02",
"1.4.2_19": "2008-12-02",
"1.3.1_24": "2008-12-02",
"6u7": "2008-07-08",
"5.0u16": "2008-07-08",
"1.3.1_23": "2008-07-08",
"1.4.2_18": "2008-06-08",
"6u6": "2008-04-15",
"6u4": "2008-01-11",
"5.0u14": "2007-11-12",
"5.0u13": "2007-10-02",
"1.4.2_16": "2007-10-02",
"6u2": "2007-07-03",
"5.0u12": "2007-05-20",
"6u1": "2007-03-13",
"5.0u11": "2007-01-29",
"6": "2006-12-12",
"1.4.2_13": "2006-11-02",
"1.3.1_19": "2006-09-12",
"1.4.2_12": "2006-06-01",
"1.3.1_18": "2006-03-21",
"1.3.1_17": "2005-12-15",
"1.4.2_10": "2005-10-31",
"1.4.2_09": "2005-08-10",
"1.3.1_16": "2005-05-31",
"1.4.2_08": "2005-03-31",
"1.4.2_07": "2005-01-24",
"1.3.1_15": "2004-12-15",
"1.4.2_06": "2004-10-11",
"1.3.1_13": "2004-08-31",
"1.3.1_12": "2004-06-07",
"1.3.1_11": "2004-02-26",
"1.3.1_10": "2003-12-16",
"1.4.1_06": "2003-11-18",
"1.4.2_02": "2003-10-17",
"1.4.2_01": "2003-08-25",
"1.4.1_04": "2003-07-24",
"1.4.2": "2003-06-26",
"1.3.1_08": "2003-04-30",
"1.4.0_04": "2003-03-31",
"1.3.1_07": "2003-01-30",
"1.4.0_03": "2002-11-14",
"1.3.1_06": "2002-10-22",
"1.1.8_010": "2002-10-09",
"1.4.1": "2002-09-19",
"1.2.2_13": "2002-07-31",
"1.2.2_013": "2002-07-31",
"1.3.1_04": "2002-06-28",
"1.3.1_03": "2002-03-28",
"1.4.0": "2002-02-13",
"1.3.1_02": "2001-12-20",
"1.2.2_10": "2001-11-01",
"1.2.2_010": "2001-11-01",
"1.3.1_01": "2001-09-04",
"1.2.2_009": "2001-07-26",
"1.2.2_09": "2001-07-26",
"1.3.1": "2001-05-17",
"1.3.0_03": "2001-03-28",
"1.1.8_13": "2001-03-28",
"1.1.8_007": "2001-03-28",
"1.2.2_07": "2000-12-21",
"1.2.2_007": "2000-12-21",
"1.1.8_006": "2000-12-21",
"1.1.6_009": "2000-08-25",
"1.1.8_11": "2000-08-18",
"1.1.8_005": "2000-08-18",
"1.2.2_006": "2000-07-12",
"1.2.2_06": "2000-07-12",
"1.3.0": "2000-05-08",
"1.2.2_05a": "2000-04-17",
"1.1.8_003": "2000-03-17",
"1.2.2_003": "1999-10-15",
"1.1.8_002": "1999-09-10",
"1.1.8_001": "1999-08-13",
"1.1.6_006": "1999-04-12",
"1.2.1": "1999-03-30",
"1.1.6_004": "1999-01-15",
"1.1.7B": "1998-12-02",
"1.1.7": "1998-09-28",
"1.1.5": "1997-12-03",
"1.1.3": "1997-07-02",
"1.1.1": "1997-03-28",
"1.0.2": "1996-05-07",
"1.0": "1996-01-23"
}

View File

@@ -13,3 +13,4 @@ six==1.16.0
soupsieve==2.3.2.post1
typing_extensions==4.3.0
webencodings==0.5.1
requests-html==0.10.0

51
src/java.py Normal file
View File

@@ -0,0 +1,51 @@
import json
from requests_html import HTMLSession
"""Fetch Java versions with their dates from https://www.java.com/releases/.
This script is using requests-html (https://requests-html.kennethreitz.org/)
because https://www.java.com/releases/ needs JavaScript to render correctly.
requests-html is using pyppeteer internally for executing javascript. And
pyppeteer is relying on Chromium, which is automatically downloaded in
~/.local/share/pyppeteer by the library. This path can be overridden by
declaring a PYPPETEER_HOME environment variable. Unfortunately exporting this
variable in the python script does not work, so it has to be done before this
script execution.
"""
PRODUCT = "java"
URL = "https://www.java.com/releases/"
def fetch_releases(releases):
session = HTMLSession()
r = session.get('https://www.java.com/releases/')
r.html.render(sleep=1, scrolldown=3)
previous_date = None
for row in r.html.find('#released tr.shade'):
version = row.find('td.anchor', first=True).attrs['id']
date = row.find('td')[1].text
date = previous_date if not date else date
print(f"{version}: {date}")
releases[version] = date
previous_date = date
def main():
print(f"::group::{PRODUCT}")
releases = {}
fetch_releases(releases)
print("::endgroup::")
with open(f"releases/{PRODUCT}.json", "w") as f:
f.write(json.dumps(
# sort by date desc
dict(sorted(releases.items(), key=lambda e: e[1], reverse=True)),
indent=2))
if __name__ == '__main__':
main()