-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (80 loc) · 2.82 KB
/
docs.yml
File metadata and controls
94 lines (80 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Docs
on:
workflow_dispatch:
workflow_run:
workflows: [Release]
types: [completed]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: jdx/mise-action@v4
- name: Get board list
id: boards
run: echo "boards=$(jq -c '[to_entries[] | select(.value.build != false) | .key]' boards.json)" >> "$GITHUB_OUTPUT"
- name: Download firmware from all releases
env:
GH_TOKEN: ${{ github.token }}
run: |
tags=$(gh release list --json tagName --jq '.[].tagName')
if [ -z "$tags" ]; then
echo "No releases found, skipping firmware download"
mkdir -p docs/firmware
echo '{"releases":[]}' > docs/firmware/index.json
exit 0
fi
boards='${{ steps.boards.outputs.boards }}'
releases_json="[]"
for tag in $tags; do
tag_boards="[]"
for board in $(echo "$boards" | jq -r '.[]'); do
mkdir -p "docs/firmware/$tag/$board"
# Download board-prefixed assets
ok=true
for file in bootloader.bin partition-table.bin esptransit.bin; do
if ! gh release download "$tag" \
--pattern "${board}-${file}" \
--output "docs/firmware/$tag/$board/$file" \
--clobber 2>/dev/null; then
ok=false
break
fi
done
if [ "$ok" = true ]; then
tag_boards=$(echo "$tag_boards" | jq --arg b "$board" '. + [$b]')
echo " Downloaded $board firmware for $tag"
else
rm -rf "docs/firmware/$tag/$board"
echo " Skipping $board for $tag (assets not found)"
fi
done
if [ "$(echo "$tag_boards" | jq 'length')" -gt 0 ]; then
releases_json=$(echo "$releases_json" | jq --arg t "$tag" --argjson b "$tag_boards" '. + [{"tag": $t, "boards": $b}]')
fi
done
mkdir -p docs/firmware
echo "{\"releases\": $releases_json}" | jq '.' > docs/firmware/index.json
echo "Generated firmware/index.json:"
cat docs/firmware/index.json
- run: uv run --group docs mkdocs build --strict
- uses: actions/upload-pages-artifact@v4
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5