Skip to content

Commit 3538cb7

Browse files
committed
fix: serve firmware binaries from GitHub Pages with correct paths
chore: force-add v2.0.0 firmware binaries (override .gitignore)
1 parent 884adc7 commit 3538cb7

7 files changed

Lines changed: 57 additions & 240 deletions

File tree

.github/workflows/release-firmware.yml

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
# Board environment name (lilygo-t-display) must match the [env:] name in platformio.ini
2-
# Check with: grep "\[env:" platformio.ini
3-
41
name: Build and Release Firmware
52

63
on:
74
push:
85
tags:
96
- 'v*'
107

8+
permissions:
9+
contents: write
10+
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
ref: master
19+
token: ${{ secrets.GITHUB_TOKEN }}
1620

1721
- name: Cache PlatformIO
1822
uses: actions/cache@v4
@@ -29,26 +33,61 @@ jobs:
2933
run: pip install platformio esptool
3034

3135
- name: Build firmware
32-
run: pio run
36+
run: pio run -e lilygo-t-display
3337

34-
- name: Merge binaries into single file
38+
- name: Merge binaries
3539
run: |
36-
esptool.py --chip esp32 merge_bin \
40+
esptool --chip esp32 merge-bin \
3741
-o merged-firmware.bin \
38-
--flash_mode qout \
39-
--flash_freq 80m \
40-
--flash_size 4MB \
42+
--flash-mode dio \
43+
--flash-freq 40m \
44+
--flash-size 4MB \
4145
0x1000 .pio/build/lilygo-t-display/bootloader.bin \
4246
0x8000 .pio/build/lilygo-t-display/partitions.bin \
4347
0x10000 .pio/build/lilygo-t-display/firmware.bin
4448
45-
- name: Create GitHub Release and upload assets
49+
- name: Copy binaries to website
50+
run: |
51+
mkdir -p website/public/firmware
52+
cp .pio/build/lilygo-t-display/bootloader.bin website/public/firmware/bootloader.bin
53+
cp .pio/build/lilygo-t-display/partitions.bin website/public/firmware/partitions.bin
54+
cp .pio/build/lilygo-t-display/firmware.bin website/public/firmware/firmware.bin
55+
cp merged-firmware.bin website/public/firmware/merged-firmware.bin
56+
57+
- name: Update manifest version
58+
run: |
59+
TAG=${GITHUB_REF#refs/tags/}
60+
cat > website/public/firmware/manifest.json << EOF
61+
{
62+
"name": "SecureGen",
63+
"version": "${TAG}",
64+
"new_install_prompt_erase": true,
65+
"builds": [
66+
{
67+
"chipFamily": "ESP32",
68+
"parts": [
69+
{ "path": "/SecureGen/firmware/bootloader.bin", "offset": 4096 },
70+
{ "path": "/SecureGen/firmware/partitions.bin", "offset": 32768 },
71+
{ "path": "/SecureGen/firmware/firmware.bin", "offset": 65536 }
72+
]
73+
}
74+
]
75+
}
76+
EOF
77+
78+
- name: Commit firmware to repo
79+
run: |
80+
git config user.name "github-actions[bot]"
81+
git config user.email "github-actions[bot]@users.noreply.github.com"
82+
git add website/public/firmware/
83+
git commit -m "firmware: update binaries for ${GITHUB_REF#refs/tags/}"
84+
git push origin master
85+
86+
- name: Create GitHub Release
4687
uses: softprops/action-gh-release@v2
4788
with:
4889
files: |
4990
merged-firmware.bin
5091
.pio/build/lilygo-t-display/bootloader.bin
5192
.pio/build/lilygo-t-display/partitions.bin
5293
.pio/build/lilygo-t-display/firmware.bin
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

website/docs/add-board.md

Lines changed: 0 additions & 181 deletions
This file was deleted.
18.5 KB
Binary file not shown.
2.84 MB
Binary file not shown.

website/public/firmware/manifest.json

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
{
22
"name": "SecureGen",
3-
"version": "latest",
3+
"version": "v2.0.0",
44
"new_install_prompt_erase": true,
55
"builds": [
66
{
77
"chipFamily": "ESP32",
88
"parts": [
9-
{
10-
"path": "https://github.com/makepkg/SecureGen/releases/latest/download/bootloader.bin",
11-
"offset": 4096
12-
},
13-
{
14-
"path": "https://github.com/makepkg/SecureGen/releases/latest/download/partitions.bin",
15-
"offset": 32768
16-
},
17-
{
18-
"path": "https://github.com/makepkg/SecureGen/releases/latest/download/firmware.bin",
19-
"offset": 65536
20-
}
9+
{ "path": "/SecureGen/firmware/bootloader.bin", "offset": 4096 },
10+
{ "path": "/SecureGen/firmware/partitions.bin", "offset": 32768 },
11+
{ "path": "/SecureGen/firmware/firmware.bin", "offset": 65536 }
2112
]
2213
}
2314
]
3 KB
Binary file not shown.

website/src/pages/flash.astro

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -502,41 +502,9 @@ import Layout from '../layouts/Layout.astro';
502502
}
503503

504504
function updateManifest() {
505-
if (!selectedBoard || releases.length === 0) return;
506-
507-
const baseUrl = selectedVersion === 'latest'
508-
? `https://github.com/${REPO}/releases/latest/download/`
509-
: `https://github.com/${REPO}/releases/download/${selectedVersion}/`;
510-
511-
const prefix = selectedBoard.asset_prefix;
512-
513-
const manifest = {
514-
name: "SecureGen",
515-
version: selectedVersion,
516-
new_install_prompt_erase: true,
517-
builds: [{
518-
chipFamily: selectedBoard.chip,
519-
parts: [
520-
{
521-
path: baseUrl + prefix + "bootloader.bin",
522-
offset: selectedBoard.offsets.bootloader
523-
},
524-
{
525-
path: baseUrl + prefix + "partitions.bin",
526-
offset: selectedBoard.offsets.partitions
527-
},
528-
{
529-
path: baseUrl + prefix + "firmware.bin",
530-
offset: selectedBoard.offsets.firmware
531-
}
532-
]
533-
}]
534-
};
535-
536-
const blob = new Blob([JSON.stringify(manifest)], { type: 'application/json' });
537505
const flashButton = document.getElementById('flash-button');
538506
if (flashButton) {
539-
flashButton.setAttribute('manifest', URL.createObjectURL(blob));
507+
flashButton.setAttribute('manifest', '/SecureGen/firmware/manifest.json');
540508
}
541509
}
542510

0 commit comments

Comments
 (0)