Update .gitea/workflows/releases.yml
All checks were successful
ESP32 Build & Release / build (push) Successful in 7m53s

This commit is contained in:
2026-09-12 11:31:57 +02:00
parent 7fc90d64de
commit 9f3d5cb146

View File

@@ -1,4 +1,4 @@
name: ESP-IDF Build & Release
name: ESP32 Build & Release
on:
push:
@@ -9,44 +9,195 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: espressif/idf:latest
steps:
# ------------------------------------------------------------
# Checkout
# ------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v4
# ------------------------------------------------------------
# System dependencies
# ------------------------------------------------------------
- name: Install system dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
git \
wget \
flex \
bison \
gperf \
python3 \
python3-pip \
python3-venv \
cmake \
ninja-build \
ccache \
libffi-dev \
libssl-dev \
dfu-util
# ------------------------------------------------------------
# Cache ESP-IDF and Espressif tools
# ------------------------------------------------------------
- name: Cache ESP-IDF
uses: actions/cache@v4
with:
path: |
~/esp/esp-idf
~/.espressif
key: esp-idf-5.5-esp32-${{ runner.os }}
restore-keys: |
esp-idf-5.5-esp32-
# ------------------------------------------------------------
# Install ESP-IDF 5.5
# ------------------------------------------------------------
- name: Install ESP-IDF 5.5
shell: bash
run: |
mkdir -p "$HOME/esp"
if [ ! -f "$HOME/esp/esp-idf/export.sh" ]; then
echo "ESP-IDF not found in cache."
echo "Cloning ESP-IDF 5.5..."
git clone --recursive \
--branch v5.5 \
https://github.com/espressif/esp-idf.git \
"$HOME/esp/esp-idf"
cd "$HOME/esp/esp-idf"
./install.sh esp32
else
echo "Using cached ESP-IDF."
fi
# ------------------------------------------------------------
# Verify ESP-IDF
# ------------------------------------------------------------
- name: Verify ESP-IDF
shell: bash
run: |
source "$HOME/esp/esp-idf/export.sh"
echo "ESP-IDF:"
idf.py --version
# ------------------------------------------------------------
# Build firmware
# ------------------------------------------------------------
- name: Build firmware
shell: bash
run: |
. /opt/esp/idf/export.sh
source "$HOME/esp/esp-idf/export.sh"
idf.py set-target esp32
idf.py build
- name: Prepare release files
# ------------------------------------------------------------
# Create merged firmware image
# ------------------------------------------------------------
- name: Create merged firmware
shell: bash
run: |
source "$HOME/esp/esp-idf/export.sh"
idf.py merge-bin
# ------------------------------------------------------------
# Prepare release artifacts
# ------------------------------------------------------------
- name: Prepare release
shell: bash
run: |
mkdir -p release
cp build/*.bin release/
cp build/bootloader/*.bin release/ 2>/dev/null || true
cp build/partition_table/*.bin release/ 2>/dev/null || true
echo "Build artifacts:"
find build -maxdepth 2 -type f \
\( -name "*.bin" -o -name "*.elf" -o -name "flasher_args.json" \) \
-print
echo "Release files:"
# Find merged binary
MERGED_BIN=$(find build -maxdepth 1 -type f -name "*.bin" | head -n 1)
if [ -z "$MERGED_BIN" ]; then
echo "ERROR: No merged .bin found"
exit 1
fi
echo "Using merged binary: $MERGED_BIN"
cp "$MERGED_BIN" release/firmware.bin
# ELF for debugging
find build -maxdepth 1 -type f -name "*.elf" \
-exec cp {} release/ \;
# Flash configuration
if [ -f build/flasher_args.json ]; then
cp build/flasher_args.json release/
fi
echo ""
echo "Release contents:"
ls -lh release/
- name: Create release
# ------------------------------------------------------------
# Delete existing "latest" release
# ------------------------------------------------------------
- name: Delete existing latest release
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
API="${{ github.server_url }}/api/v1"
echo "Removing existing latest release..."
curl -fsSL \
-X DELETE \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/repos/${{ github.repository }}/releases/tags/latest" \
|| true
# Delete the tag as well
curl -fsSL \
-X DELETE \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/repos/${{ github.repository }}/tags/latest" \
|| true
# ------------------------------------------------------------
# Create latest release
# ------------------------------------------------------------
- name: Create latest release
uses: akkuman/gitea-release-action@v1
with:
server_url: ${{ github.server_url }}
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "build-${{ github.sha }}"
name: "ESP32 build ${{ github.sha }}"
body: |
Automated ESP-IDF firmware build.
Commit: ${{ github.sha }}
tag_name: latest
name: "Latest ESP32 Firmware"
body: |
Automatically built from the `main` branch.
Commit:
${{ github.sha }}
ESP-IDF:
5.5
Target:
ESP32
This release is automatically replaced on every push to `main`.
files: |
release/*.bin
release/*