[docs] Generate JSON file with supported boards

This commit is contained in:
Kuba Szczodrzyński
2022-12-06 21:33:48 +01:00
parent ec4e946643
commit 665ab22de5
2 changed files with 28 additions and 0 deletions

View File

@@ -13,6 +13,17 @@ jobs:
- name: Checkout main - name: Checkout main
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install ltchiptool
run: pip install ltchiptool
- name: Generate static JSON files
run: python docs/build_json.py
- name: Set custom domain - name: Set custom domain
run: | run: |
mkdir -p site/ mkdir -p site/

17
docs/build_json.py Normal file
View File

@@ -0,0 +1,17 @@
import json
from ltchiptool import Board
from update_docs import board_obj_sort
boards = map(Board, Board.get_list())
boards = list(sorted(boards, key=board_obj_sort))
for i, board in enumerate(boards):
boards[i] = dict(
name=board.name,
title=board.title,
vendor=board.vendor,
mcu=board.family.short_name,
)
with open("boards.json", "w") as f:
json.dump(boards, f)