CI: determine actual OpenSSL version dynamically

this change introduce "OPENSSL_VERSION=latest" semantic, which scans
https://api.github.com/repos/openssl/openssl/tags and detects latest release.

(cherry picked from commit 7b893c2c6b68be5cd133c4cf39e61d89f341d810)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ca1d09d258be9789efe2ed7085d3e1c9b44af6db)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/.github/matrix.py b/.github/matrix.py
index 5e56838..dd04299 100644
--- a/.github/matrix.py
+++ b/.github/matrix.py
@@ -31,6 +31,17 @@
 def clean_ssl(ssl):
     return ssl.replace("_VERSION", "").lower()
 
+def determine_latest_openssl(ssl):
+    openssl_tags = urllib.request.urlopen("https://api.github.com/repos/openssl/openssl/tags")
+    tags = json.loads(openssl_tags.read().decode('utf-8'))
+    latest_tag = ''
+    for tag in tags:
+        name = tag['name']
+        if "openssl-" in name:
+            if name > latest_tag:
+               latest_tag = name
+    return "OPENSSL={}".format(latest_tag[8:])
+
 def determine_latest_libressl(ssl):
     libressl_download_list = urllib.request.urlopen("http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/")
     for line in libressl_download_list.readlines():
@@ -117,7 +128,7 @@
     for ssl in [
         "stock",
         "OPENSSL_VERSION=1.0.2u",
-        "OPENSSL_VERSION=3.0.2",
+        "OPENSSL_VERSION=latest",
         "LIBRESSL_VERSION=latest",
 #        "BORINGSSL=yes",
     ]:
@@ -131,6 +142,9 @@
             flags.append("SSL_INC=${HOME}/opt/include")
         if "LIBRESSL" in ssl and "latest" in ssl:
             ssl = determine_latest_libressl(ssl)
+        if "OPENSSL" in ssl and "latest" in ssl:
+            ssl = determine_latest_openssl(ssl)
+
         matrix.append(
             {
                 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),