Skip to content

Commit 6093372

Browse files
author
Tom Lasswell
committed
feat(readme): self-host release + license endpoint badges
1 parent 7ada639 commit 6093372

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
**Control Govee lights, plugs, fans, humidifiers, heaters, thermometers & leak sensors — with optional real‑time push over Govee's AWS IoT MQTT.**
66

77
[![HACS Custom](https://img.shields.io/badge/HACS-Custom-41BDF5?style=flat-square)](https://github.com/hacs/integration)
8-
[![Release](https://img.shields.io/github/v/release/lasswellt/govee-homeassistant?style=flat-square&color=41BDF5)](https://github.com/lasswellt/govee-homeassistant/releases)
8+
[![Release](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lasswellt/govee-homeassistant/badges/release.json)](https://github.com/lasswellt/govee-homeassistant/releases)
99
![Home Assistant](https://img.shields.io/badge/Home%20Assistant-2024.11+-41BDF5?style=flat-square&logo=home-assistant&logoColor=white)
1010
![Quality scale](https://img.shields.io/badge/quality%20scale-silver-silver?style=flat-square)
11-
[![License](https://img.shields.io/github/license/lasswellt/govee-homeassistant?style=flat-square&color=41BDF5)](LICENSE.txt)
11+
[![License](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lasswellt/govee-homeassistant/badges/license.json)](LICENSE.txt)
1212

1313
[![Active installs](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lasswellt/govee-homeassistant/badges/installs.json)](https://analytics.home-assistant.io/)
1414
[![Govee API status](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lasswellt/govee-homeassistant/badges/api-status.json)](#-live-status)

scripts/status_badges.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,21 @@ def run_installs(data_dir: Path, repo_dir: Path) -> None:
298298
write_json(data_dir / "installs.json", shields_endpoint("active installs", human(fork_total), "41BDF5"))
299299
(data_dir / "installs-trend.svg").write_text(render_installs_svg(history, fork_total, official_total))
300300
(data_dir / "versions.svg").write_text(render_versions_svg(fork_counts, fork_total))
301+
302+
# release + license endpoint badges (self-hosted — avoid shields github-token-pool errors)
303+
manifest = repo_dir / "custom_components" / DOMAIN / "manifest.json"
304+
ver = json.loads(manifest.read_text()).get("version", "") if manifest.exists() else ""
305+
if ver:
306+
write_json(data_dir / "release.json", shields_endpoint("release", f"v{ver}", "41BDF5"))
307+
lic_file = repo_dir / "LICENSE.txt"
308+
lic = "MIT"
309+
if lic_file.exists():
310+
first = lic_file.read_text().splitlines()[0].strip()
311+
lic = first.replace(" License", "").strip() or "MIT"
312+
write_json(data_dir / "license.json", shields_endpoint("license", lic, "41BDF5"))
313+
301314
print(f"[installs] fork={fork_total} (of {official_total} domain total) "
302-
f"versions_matched={len(fork_counts)}")
315+
f"versions_matched={len(fork_counts)} release=v{ver} license={lic}")
303316

304317

305318
# --------------------------------------------------------------------------- #

0 commit comments

Comments
 (0)