This way the writing of the JSON file is handled automatically if the update does not fail.
It pave the way to further global improvements, such as a better error handling.
It may not be the best place for that (gha.py would have been better), but it's the shorter / faster way to do it for now.
Moreover it now uses logging for writing the group. The logger format has been updated for this to work. This was done to fix issues on GitHub Action logs, where groups were declared after the logs.
Make the script more readable, mostly by:
- using the Product class,
- removing the use of functions when unnecessary,
- a little bit of renaming and documentation.
This script also does not need an hard-coded list of major versions anymore, making it more maintainable.
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).
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 creates a common function to fetch HTTP URLs, with enhanced capabilities (retry, use of a known User-Agent).
It makes scripts that need those capabilities simpler, while improving other scripts.
This commit also fixes some scripts that did not log properly (cos.py, eks.py, haproxy.py, palo-alto-networks.py, rhel.py, ros.py, unrealircd.py).
This uses the PHP releases API. Limitations:
1. New Major versions will needed to be added manually
The src for the API is at https://github.com/php/web-php/blob/master/releases/index.php
The data comes from https://github.com/php/web-php/blob/master/include/releases.inc
This commit keeps the old sort method for a cleaner diff. Next commits
in this PR will fix the sorting to be standardized.
The difference from using tags is:
1. One additional version shows up (4.0.4) which we'd missed previously
due to being tagged as php-4.0.4REL.
2. Slightly more accurate dates.