Files
endoflife-date-release-data/src/php.py
Marc Wrobel 0d17306872 Simplify date parsing (#195)
Create common functions parse_date, parse_month_year_date and parse_datetime.

Those functions support trying multiple formats, and come with default formats lists that support most of the date format encountered so far.

Notable change: year-month dates are now set to the end of month (impacted couchbase-server and ibm-aix).
2023-11-26 21:01:35 +01:00

26 lines
630 B
Python

import json
from common import dates
from common import endoflife
PHP_MAJOR_VERSIONS = [4, 5, 7, 8]
def fetch_versions(major_version):
url = f"https://www.php.net/releases/index.php?json&max=-1&version={major_version}"
response = endoflife.fetch_url(url)
data = json.loads(response)
for v in data:
data[v] = dates.parse_date(data[v]["date"]).strftime("%Y-%m-%d")
print(f"{v}: {data[v]}")
return data
print("::group::php")
versions = {}
for major_version in PHP_MAJOR_VERSIONS:
versions |= fetch_versions(major_version)
endoflife.write_releases('php', versions)
print("::endgroup::")