-
-
Notifications
You must be signed in to change notification settings - Fork 14
172 lines (154 loc) 路 5.28 KB
/
Copy pathrelease-firmware.yml
File metadata and controls
172 lines (154 loc) 路 5.28 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build & Release Firmware
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- env: lilygo-t-display
chip: esp32
label: esp32
- env: lilygo-t-display-s3
chip: esp32s3
label: s3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: pio-${{ matrix.env }}-${{ hashFiles('platformio.ini') }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install tools
run: pip install platformio esptool
- name: Build ${{ matrix.label }}
run: pio run -e ${{ matrix.env }}
- name: Merge binaries
run: |
if [ "${{ matrix.chip }}" = "esp32" ]; then
BOOTLOADER_OFFSET=0x1000
else
BOOTLOADER_OFFSET=0x0
fi
esptool.py --chip ${{ matrix.chip }} merge_bin \
-o merged-firmware-${{ matrix.label }}.bin \
--flash_mode dio \
--flash_freq 80m \
--flash_size 16MB \
${BOOTLOADER_OFFSET} .pio/build/${{ matrix.env }}/bootloader.bin \
0x8000 .pio/build/${{ matrix.env }}/partitions.bin \
0x10000 .pio/build/${{ matrix.env }}/firmware.bin
- name: Collect artifacts
run: |
mkdir -p dist-${{ matrix.label }}
cp .pio/build/${{ matrix.env }}/bootloader.bin dist-${{ matrix.label }}/bootloader-${{ matrix.label }}.bin
cp .pio/build/${{ matrix.env }}/partitions.bin dist-${{ matrix.label }}/partitions-${{ matrix.label }}.bin
cp .pio/build/${{ matrix.env }}/firmware.bin dist-${{ matrix.label }}/firmware-${{ matrix.label }}.bin
cp merged-firmware-${{ matrix.label }}.bin dist-${{ matrix.label }}/
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.label }}
path: dist-${{ matrix.label }}/
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-firmware/
- name: Prepare website firmware folder
run: |
mkdir -p website/public/firmware
cp all-firmware/firmware-esp32/* website/public/firmware/
cp all-firmware/firmware-s3/* website/public/firmware/
- name: Generate boards.json
run: |
cat > website/public/firmware/boards.json << 'EOF'
{
"boards": [
{
"id": "lilygo-t-display",
"name": "LILYGO T-Display ESP32",
"chip": "ESP32",
"description": "ESP32 with 1.14\" SPI display (135脳240)",
"asset_prefix": "esp32",
"offsets": {
"bootloader": 4096,
"partitions": 32768,
"firmware": 65536
}
},
{
"id": "lilygo-t-display-s3",
"name": "LILYGO T-Display-S3",
"chip": "ESP32-S3",
"description": "ESP32-S3 with 1.9\" parallel display (170脳320), 8MB PSRAM, USB HID",
"asset_prefix": "s3",
"offsets": {
"bootloader": 0,
"partitions": 32768,
"firmware": 65536
}
}
]
}
EOF
- name: Generate manifest.json
run: |
TAG=${{ github.ref_name }}
cat > website/public/firmware/manifest.json << EOF
{
"name": "SecureGen",
"version": "${TAG}",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32",
"parts": [
{ "path": "/SecureGen/firmware/merged-firmware-esp32.bin", "offset": 0 }
]
},
{
"chipFamily": "ESP32-S3",
"parts": [
{ "path": "/SecureGen/firmware/merged-firmware-s3.bin", "offset": 0 }
]
}
]
}
EOF
- name: Commit firmware to website
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -f website/public/firmware/
git commit -m "firmware: update binaries for ${{ github.ref_name }}" || true
git push origin HEAD:master
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
all-firmware/firmware-esp32/merged-firmware-esp32.bin
all-firmware/firmware-esp32/firmware-esp32.bin
all-firmware/firmware-s3/merged-firmware-s3.bin
all-firmware/firmware-s3/firmware-s3.bin