[visualstudio] Add automation (#199)
Automation is only for the latest 3 majors version (2022, 2019 and 2017) as there is no release history published for 2015 and below. This is not a big deal because there was no version for those release in a very long time.
This commit is contained in:
43
src/visualstudio.py
Normal file
43
src/visualstudio.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import re
|
||||
from bs4 import BeautifulSoup
|
||||
from common import dates
|
||||
from common import endoflife
|
||||
|
||||
PRODUCT = "visualstudio"
|
||||
|
||||
# There is no build history for versions 2015 and below.
|
||||
# This is not a big deal because there was no version for those release in a very long time.
|
||||
URLS = [
|
||||
"https://learn.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-history",
|
||||
"https://learn.microsoft.com/en-us/visualstudio/releases/2019/history",
|
||||
"https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history",
|
||||
]
|
||||
|
||||
print(f"::group::{PRODUCT}")
|
||||
versions = {}
|
||||
|
||||
for response in endoflife.fetch_urls(URLS):
|
||||
soup = BeautifulSoup(response.text, features="html5lib")
|
||||
for table in soup.find_all("table"):
|
||||
headers = [th.get_text().strip().lower() for th in table.find_all("th")]
|
||||
if "version" not in headers or "release date" not in headers:
|
||||
continue
|
||||
|
||||
version_index = headers.index("version")
|
||||
date_index = headers.index("release date")
|
||||
for row in table.findAll("tr"):
|
||||
cells = row.findAll("td")
|
||||
if len(cells) < (max(version_index, date_index) + 1):
|
||||
continue
|
||||
|
||||
version = cells[version_index].get_text().strip()
|
||||
date = cells[date_index].get_text().strip()
|
||||
date = dates.parse_date(date).strftime("%Y-%m-%d")
|
||||
|
||||
if date and version and re.match(endoflife.DEFAULT_VERSION_REGEX, version):
|
||||
versions[version] = date
|
||||
print(f"{version}: {date}")
|
||||
|
||||
|
||||
endoflife.write_releases(PRODUCT, versions)
|
||||
print("::endgroup::")
|
||||
Reference in New Issue
Block a user