Skip to content

workflow

workflow #1

name: Platformio Auto Build Firmwares
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for contributor config (will abort if builds/owner/platformio.ini does not exist)
run: |
if [ ! -f "builds/${{ github.repository_owner }}/platformio.ini" ]; then
echo "No config found for ${{ github.repository_owner }}. Skipping build."
exit 1
fi
- name: Copy contributor config files to project root
run: |
if [ -d "builds/${{ github.repository_owner }}" ]; then
cp -rf builds/${{ github.repository_owner }}/* .
fi
- name: Prepare Gzipped Web Assets for Release
run: |
mkdir -p www_release
for file in data/www/*; do
filename=$(basename "$file")
if [[ "$filename" == *.gz ]]; then
echo "Copying $filename without compression (already gzipped)."
cp "$file" "www_release/"
elif [[ "$filename" == "rb_srvrs.json" ]]; then
echo "Skipping $filename from release assets."
else
echo "Compressing $filename."
gzip -c -9 "$file" > "www_release/$filename.gz"
fi
done
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Extract version
run: grep '#define RADIOVERSION ' src/core/options.h > version.txt
- name: Install PlatformIO
run: pip install platformio
- name: Make binaries folder to stash .bin files
run: mkdir -p binaries
- name: Build all firmwares
run: pio run
- name: Rename firmware files with env name
run: |
for d in .pio/build/*/ ; do
env=$(basename "$d")
if [ -f "$d/firmware.bin" ]; then
cp "$d/firmware.bin" "binaries/${env}.bin"
fi
done
- name: Save bootloader/partitions for each board environment
run: |
# Extract all environments prefixed with 'board' from platformio.ini
board_envs=$(grep -oP '(?<=\[env:board_)[^\]]+' platformio.ini | tr '\n' ' ')
echo "Board environments: $board_envs"
# Iterate over all board environments
for env in $board_envs; do
echo "Processing environment: $env"
# Copy and rename bootloader and partitions binaries
cp .pio/build/board_$env/bootloader.bin binaries/${env}_bootloader.bin
cp .pio/build/board_$env/partitions.bin binaries/${env}_partitions.bin
done
- name: Build SPIFFS and extract bootloader/partitions for each board environment
run: |
# Extract all environments prefixed with 'board' from platformio.ini
board_envs=$(grep -oP '(?<=\[env:board_)[^\]]+' platformio.ini | tr '\n' ' ')
echo "Board environments: $board_envs"
# Iterate over all board environments
for env in $board_envs; do
echo "Processing environment: $env"
# Build SPIFFS
pio run --environment board_$env --target buildfs
# Copy and rename SPIFFS binaries
cp .pio/build/board_$env/spiffs.bin binaries/${env}_spiffs.bin
done
# Here we also make some OTA-TEST builds (to be deleted later)
# - name: Prepare TEST-OTA version in options.h
# run: |
# # append “-OTA-TEST” inside the quotes of the RADIOVERSION line
# sed -i '/#define RADIOVERSION/ s/"\([^"]*\)"/"\1-OTA-TEST"/' src/core/options.h
# - name: Prepare TEST-OTA PlatformIO builds in platformio.ini
# run: |
# # for every “[env:…]” line, append “_ota_test” before the closing bracket
# sed -i '/^\[env:/ s/]/_ota_test]/' platformio.ini
# # also update any ${env:…​.lib_deps} macros to include _ota_test
# sed -Ei 's|\$\{env:([^}]+)\.lib_deps\}|\$\{env:\1_ota_test.lib_deps\}|g' platformio.ini
# # update any extends = env:… lines to include _ota_test
# sed -i 's/^\(extends[[:space:]]*=[[:space:]]*env:[^[:space:]]*\)/\1_ota_test/' platformio.ini
# - name: Build TEST-OTA firmwares
# run: pio run
# - name: Rename firmware files with env name
# run: |
# for d in .pio/build/*/ ; do
# env=$(basename "$d")
# if [ -f "$d/firmware.bin" ]; then
# cp "$d/firmware.bin" "binaries/${env}.bin"
# fi
# done
# End of OTA-TEST builds
# End of Notes:
# - the `_ota_test` files are just to show off that online OTA can work
# - functionally identical to a normal .bin
# - they have a "fake" version that will allow an update to a normal .bin
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
## Pre-built Firmwares & WebUI Assets
### Notes
- You can download .bin files and flash to your ESP with `esptool`
- you will need a firmware file appropriate to your build (see below)
- depending on your board, choose the appropriate `esp32*_bootloader.bin` and `esp32*_partitions.bin`
- you could also upload the `esp32*_spiffs.bin` - this will erase any files already there (playlist and wi-fi data)
- for 4MB flash (most ESP32s), use:
- `esptool --chip esp32 --port com14 --baud 460800 write_flash -z 0x1000 esp32_bootloader.bin 0x8000 esp32_partitions.bin 0x10000 esp32_*.bin`
- to include spiffs, add this to the above command: `0x390000 esp32_spiffs.bin`
- this is a non-standard partition format for ESP32
- for 8MB flash (most ESP32-S3s) use:
- `esptool --chip esp32s3 --port com14 --baud 460800 write_flash -z 0x0000 esp32_s3_bootloader.bin 0x8000 esp32_s3_partitions.bin 0x10000 esp32_s3_*.bin`
- to include spiffs, add this to the above command: `0x00670000 esp32_s3_spiffs.bin`
- this is a standard partition format for ESP32-S3 with 8MB of flash
## Boards
- each of the pre-built board binaries have pre-set hardware configurations, they cannot be changed
- to view pin usage, click the link and scroll down then click preview
### Bare board firmwares (no peripherals, may be used for testing)
- `board_esp32.bin`
- `board_esp32_s3_n16r8.bin`
### Trip5 Firmwares (all ESP32-S3-N16R8 builds - click for board config)
- [`esp32_s3_trip5_sh1106_pcm_remote.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,7,15,43,49,51,52,53,54,75,66&i=5,6,15,16,17,22,23,24,25,26,27,28,29,30,39,45,46,47,40&v=42,41,12,11,10,7,18,15,17,16,255,40,39,38,47,21,13,14,8)
- [`esp32_s3_trip5_sh1106_pcm_1button.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,15,43,49,51,52,53,54,75&i=5,6,15,16,17,22,23,24,25,26,27,28,29,30,39,45,46,47&v=42,41,12,11,10,255,255,255,255,17,255,7,15,16,47,21,13,14)
- [`esp32_s3_trip5_ssd1306x32_pcm_1button.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,17,43,49,51,52,53,54,75&i=5,6,15,16,17,22,23,24,25,26,27,28,29,30,39,45,46,47&v=42,41,12,11,10,255,255,255,255,17,255,7,15,16,47,21,13,14)
- [`esp32_s3_trip5_sh1106_vs1053_3buttons.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,15,44,48,49,51,52,53,54,75&i=5,6,18,19,20,21,22,23,24,25,26,27,28,29,30,39,45,46,47&v=42,41,9,14,10,-1,255,255,255,17,18,16,40,39,38,47,21,2,1)
- [`esp32_s3_trip5_st7735_pcm_1button.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,11,36,43,49,51,52,53,54,75&i=1,2,3,4,15,16,17,22,23,24,25,26,27,28,29,30,39,45,46,47&v=10,9,-1,4,15,7,6,255,255,255,255,42,255,40,39,38,47,21,13,14)
- [`esp32_s3_trip5_ili9488_pcm_1button.bin`](https://trip5.github.io/ehRadio_myoptions/generator.html?b=ESP32-S3-DevKitC-1_44Pin&r=72,2,3,4,6,31,43,49,51,52,53,54,75&i=1,2,3,4,15,16,17,22,23,24,25,26,27,28,29,30,39,45,46,47&v=10,9,-1,4,15,7,6,255,255,255,255,42,255,40,39,38,47,21,2,1)
### Add Yours
- you can either fork my `ehradio` repo and edit these files or request a build be added
- use [the generator](https://trip5.github.io/ehRadio_myoptions/generator.html) and copy the link and include it in your request
### Web Assets
- all other files are needed for the WebUI functionality
- they are available here to allow automatic downloading to SPIFFS
- it is NOT necessary to download them (or the SPIFFS bin)
files: |
binaries/*.bin
www_release/*
version.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}