📝 Generate changelogs

This commit is contained in:
Nikhil Badyal
2022-10-24 15:23:30 +05:30
parent d620acbbf6
commit d62679539d
4 changed files with 129 additions and 1 deletions
+6
View File
@@ -1,4 +1,5 @@
"""Downloader Class."""
import os
import re
import sys
from concurrent.futures import ThreadPoolExecutor
@@ -12,6 +13,7 @@ from selectolax.lexbor import LexborHTMLParser
from tqdm import tqdm
from src.config import RevancedConfig
from src.utils import update_changelog
class Downloader(object):
@@ -160,10 +162,14 @@ class Downloader(object):
download_url = r.json()["assets"][1]["browser_download_url"]
else:
download_url = r.json()["assets"][0]["browser_download_url"]
update_changelog(f"{owner}/{name}", r.json())
self._download(download_url, file_name=file_name)
def download_revanced(self) -> None:
"""Download Revanced and Extended Patches, Integration and CLI."""
if os.path.exists("changelog.md"):
logger.debug("Deleting old changelog.md")
os.remove("changelog.md")
assets = [
["revanced", "revanced-cli", self.config.normal_cli_jar],
["revanced", "revanced-integrations", self.config.normal_integrations_apk],
+28
View File
@@ -1,4 +1,6 @@
"""Utilities."""
from typing import Dict
supported_apps = [
"youtube",
"youtube_music",
@@ -9,3 +11,29 @@ supported_apps = [
"spotify",
]
possible_archs = ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
def update_changelog(name: str, response: Dict[str, str]) -> None:
"""Updated Changelog."""
parent_repo = "https://github.com/nikhilbadyal/docker-py-revanced"
file1 = open("changelog.md", "a")
collapse_start = f"\n<details> <summary>👀 {name} </summary>\n\n"
release_version = (
f"**Release Version** - [{response['tag_name']}]({response['html_url']})<br>"
)
change_log = f"**Changelog** -<br> {response['body']}"
publish_time = f"**Published at** -<br> {response['published_at']}"
footer = (
f"<br><sub>Change logs generated by [Docker Py Revanced]({parent_repo})</sub>\n"
)
collapse_end = "</details>"
change_log = (
collapse_start
+ release_version
+ change_log
+ publish_time
+ footer
+ collapse_end
)
file1.write(change_log)
file1.close()