From 5f93cc45d73f95e08e51d6582054007720decf9c Mon Sep 17 00:00:00 2001 From: "Mio." Date: Sat, 28 Jun 2025 20:28:28 +0200 Subject: [PATCH] Update README and add step to automatically update version badge --- .github/scripts/create-repo.py | 24 ++++++++++++++++++++---- README.md | 20 +++++++++++--------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/scripts/create-repo.py b/.github/scripts/create-repo.py index bbcd54c2..80f429b8 100644 --- a/.github/scripts/create-repo.py +++ b/.github/scripts/create-repo.py @@ -9,8 +9,10 @@ PACKAGE_NAME_REGEX = re.compile(r"package: name='([^']+)'") VERSION_CODE_REGEX = re.compile(r"versionCode='([^']+)'") VERSION_NAME_REGEX = re.compile(r"versionName='([^']+)'") IS_NSFW_REGEX = re.compile(r"'tachiyomi.extension.nsfw' value='([^']+)'") -APPLICATION_LABEL_REGEX = re.compile(r"^application-label:'([^']+)'", re.MULTILINE) -APPLICATION_ICON_320_REGEX = re.compile(r"^application-icon-320:'([^']+)'", re.MULTILINE) +APPLICATION_LABEL_REGEX = re.compile( + r"^application-label:'([^']+)'", re.MULTILINE) +APPLICATION_ICON_320_REGEX = re.compile( + r"^application-icon-320:'([^']+)'", re.MULTILINE) LANGUAGE_REGEX = re.compile(r"tachiyomi-([^.]+)") *_, ANDROID_BUILD_TOOLS = (Path(os.environ["ANDROID_HOME"]) / "build-tools").iterdir() @@ -36,7 +38,8 @@ for apk in REPO_APK_DIR.iterdir(): ] ).decode() - package_info = next(x for x in badging.splitlines() if x.startswith("package: ")) + package_info = next(x for x in badging.splitlines() + if x.startswith("package: ")) package_name = PACKAGE_NAME_REGEX.search(package_info).group(1) application_icon = APPLICATION_ICON_320_REGEX.search(badging).group(1) @@ -85,4 +88,17 @@ for apk in REPO_APK_DIR.iterdir(): index_min_data.append(min_data) with REPO_DIR.joinpath("index.min.json").open("w", encoding="utf-8") as index_file: - json.dump(index_min_data, index_file, ensure_ascii=False, separators=(",", ":")) + json.dump(index_min_data, index_file, + ensure_ascii=False, separators=(",", ":")) + +# --- Generate badge-version.json --- +if index_min_data: + latest_version = index_min_data[0]["version"] + badge_data = { + "schemaVersion": 1, + "label": "Current Version", + "message": latest_version, + "color": "61affe" + } + with REPO_DIR.joinpath("badge-version.json").open("w", encoding="utf-8") as badge_file: + json.dump(badge_data, badge_file, ensure_ascii=False, indent=2) diff --git a/README.md b/README.md index 2e17e2f8..d0a1dcf4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@

- + Build Status - - - Current Version - - - Install Kavita Extension - + + +Current Version + + + Install Kavita Repo +

# Kavita Extension @@ -22,7 +22,9 @@ This repository contains the Kavita extension, compatible with [Komikku](https:/ ## How to add the repo -[![Install](https://img.shields.io/badge/Install%20Kavita%20Extension-49CC90?style=for-the-badge&logo=cloudsmith&logoColor=white&labelColor=49CC90&color=49CC90)](https://intradeus.github.io/http-protocol-redirector/?r=tachiyomi://add-repo?url=https://raw.githubusercontent.com/Kareadita/tach-extensions/repo/index.min.json) + + Install Kavita Repo + Or copy & paste this URL into your app: