[docs] Generate JSON file with supported boards
This commit is contained in:
11
.github/workflows/docs.yml
vendored
11
.github/workflows/docs.yml
vendored
@@ -13,6 +13,17 @@ jobs:
|
||||
- name: Checkout main
|
||||
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
|
||||
run: |
|
||||
mkdir -p site/
|
||||
|
||||
17
docs/build_json.py
Normal file
17
docs/build_json.py
Normal 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)
|
||||
Reference in New Issue
Block a user