[confluence] Add release automation

This commit is contained in:
Marc Wrobel
2023-10-07 11:33:20 +02:00
parent 3fdafc5b7d
commit f74a12a855

36
src/confluence.py Normal file
View File

@@ -0,0 +1,36 @@
from requests_html import HTMLSession
from common import endoflife
from datetime import datetime
"""Fetch Confluence versions with their dates from the Atlassian Website.
This script is using requests-html (https://requests-html.kennethreitz.org/)
because the page needs JavaScript to render correctly.
"""
PRODUCT = 'confluence'
URL = 'https://www.atlassian.com/software/confluence/download-archives'
def parse_date(text):
return datetime.strptime(text, "%d-%b-%Y").strftime("%Y-%m-%d")
print(f"::group::{PRODUCT}")
session = HTMLSession()
r = session.get(URL)
r.html.render(sleep=1, scrolldown=3)
versions = {}
for version_block in r.html.find('.versions-list'):
version = version_block.find('a.product-versions', first=True).attrs['data-version']
date = parse_date(version_block.find('.release-date', first=True).text)
print(f"{version}: {date}")
versions[version] = date
endoflife.write_releases(PRODUCT, dict(
# sort by date then version (asc)
sorted(versions.items(), key=lambda x: (x[1], x[0]))
))
print("::endgroup::")