88
99 steps :
1010 - name : Check out repository
11- uses : actions/checkout@v2
11+ uses : actions/checkout@v4
1212
13- - uses : arduino/compile-sketches@v1
13+ - name : Setup Arduino CLI
14+ uses : arduino/setup-arduino-cli@v2
1415 with :
15- fqbn : " esp32:esp32:esp32s2"
16- platforms : |
17- - name: esp32:esp32
18- source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
19- version: 3.2.0
20- libraries : |
21- - name: FastLED
22- - name: Sensirion Core
23- - name: Sensirion I2C SCD4x
24- - name: WiFiManager
25- - name: esp32-waveshare-epd
26- source-path: ./esp32-waveshare-epd
27- sketch-paths : |
28- - .
16+ version : latest
17+
18+ - name : Install ESP32 core + libraries
19+ shell : bash
20+ run : |
21+ set -euo pipefail
22+
23+ ESP_URL="https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
24+
25+ arduino-cli core update-index --additional-urls "$ESP_URL"
26+ arduino-cli core install esp32:esp32@3.2.0 --additional-urls "$ESP_URL"
27+
28+ arduino-cli lib update-index
29+ arduino-cli lib install "FastLED" "Sensirion Core" "Sensirion I2C SCD4x" "WiFiManager"
30+
31+ - name : Compile and export binaries
32+ shell : bash
33+ run : |
34+ set -euo pipefail
35+
36+ INO="$(find . -maxdepth 3 -type f -name '*.ino' | head -n 1)"
37+ if [[ -z "${INO:-}" ]]; then
38+ echo "ERROR: No .ino sketch found."
39+ exit 1
40+ fi
41+
42+ SKETCH_DIR="$(dirname "$INO")"
43+ echo "Using sketch: $INO"
44+ echo "Sketch directory: $SKETCH_DIR"
45+
46+ arduino-cli compile \
47+ --fqbn "esp32:esp32:esp32s2" \
48+ --additional-urls "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" \
49+ --library "$GITHUB_WORKSPACE/esp32-waveshare-epd" \
50+ --export-binaries \
51+ "$SKETCH_DIR"
52+
53+ echo "Exported binaries:"
54+ find "$SKETCH_DIR" -type f -name '*.bin' -print || true
55+
56+ - name : Create FIRMWARE.BIN
57+ shell : bash
58+ run : |
59+ set -euo pipefail
60+
61+ BIN="$(
62+ find . -type f -name '*.bin' \
63+ ! -path '*/.git/*' \
64+ ! -name '*bootloader*' \
65+ ! -name '*partitions*' \
66+ ! -name '*ota_data_initial*' \
67+ -printf '%s %p\n' \
68+ | sort -nr \
69+ | head -n 1 \
70+ | awk '{print $2}'
71+ )"
72+
73+ if [[ -z "${BIN:-}" || ! -f "$BIN" ]]; then
74+ echo "ERROR: No firmware .bin found."
75+ echo "All .bin files found (for debugging):"
76+ find . -type f -name '*.bin' -print || true
77+ exit 1
78+ fi
79+
80+ echo "Selected firmware bin: $BIN"
81+ cp "$BIN" FIRMWARE.BIN
82+
83+ - name : Upload firmware artifact
84+ uses : actions/upload-artifact@v4
85+ with :
86+ name : firmware
87+ path : FIRMWARE.BIN
0 commit comments