diff --git a/scripts/__pycache__/package_firmware.cpython-311.pyc b/scripts/__pycache__/package_firmware.cpython-311.pyc new file mode 100644 index 00000000..2e6e93e0 Binary files /dev/null and b/scripts/__pycache__/package_firmware.cpython-311.pyc differ diff --git a/scripts/package_firmware.py b/scripts/package_firmware.py index 85568ce0..4c058755 100644 --- a/scripts/package_firmware.py +++ b/scripts/package_firmware.py @@ -25,7 +25,7 @@ import json import os from pathlib import Path from datetime import datetime, timezone -from typing import Dict, Iterable, Optional +from typing import Dict, Iterable, List, Optional DEFAULT_CHANNEL = "stable" DEFAULT_OUTPUT = Path("dist") @@ -167,19 +167,71 @@ def package_environment( } -def write_index(output_dir: Path, summary: Iterable[Dict[str, str]], published_at: str, version: str) -> None: +def write_index(output_dir: Path, summary: Iterable[Dict[str, str]], published_at: str, version: str) -> List[Dict[str, str]]: summary_list = [item for item in summary if item] - if not summary_list: - return + if summary_list: + index_path = output_dir / "firmware" / "index.json" + index_path.parent.mkdir(parents=True, exist_ok=True) + index = { + "generated_at": published_at, + "version": version, + "artifacts": summary_list, + } + index_path.write_text(json.dumps(index, indent=2)) + return summary_list - index_path = output_dir / "firmware" / "index.json" - index_path.parent.mkdir(parents=True, exist_ok=True) - index = { - "generated_at": published_at, - "version": version, - "artifacts": summary_list, - } - index_path.write_text(json.dumps(index, indent=2)) + +def write_root_index(output_dir: Path, artifacts: List[Dict[str, str]], channel: str, version: str, published_at: str) -> None: + index_path = output_dir / "index.html" + rows = [] + for artifact in artifacts: + manifest_href = artifact.get("manifest") + binary_href = artifact.get("binary") + zip_href = artifact.get("zip") + chip = artifact.get("chip", "?") + env = artifact.get("env", "?") + row = f"
Channel: {channel} · Published at: {published_at}
+The table below lists all firmware bundles generated by the release workflow. Devices should download the manifest matching their chip.
+| Chip | Environment | Manifest | Binary | Zip |
|---|