esp-idf-ci/action.yml
2025-04-06 14:05:38 +02:00

38 lines
No EOL
1.4 KiB
YAML

name: "Espressif IoT Development Framework (ESP-IDF)"
description: "This action builds your firmware for ESP32 directly in GitHub using Espressif ESP-IDF Docker image."
branding:
color: red
icon: wifi
inputs:
path:
description: "Relative path under $GITHUB_WORKSPACE to place the repository"
default: ""
required: false
target:
description: "ESP32 variant to build for"
default: "esp32"
required: false
artifacts_dir:
description: "Directory to put the artifacts"
default: "build/artifacts"
required: false
runs:
using: 'docker'
image: 'docker://espressif/idf:v5.4'
args:
- /bin/bash
- -c
- |
set -e;
cd "$(dirname "${{ inputs.path }}")/$(basename "${{ inputs.path }}")"
export IDF_TARGET=$(echo "${{ inputs.target }}" | tr '[:upper:]' '[:lower:]' | tr -d '_-');
git config --global --add safe.directory "*";
echo "**** build project ****";
idf.py build;
export IDF_PROJECT_NAME=$(cat build/project_description.json | python -c 'import json, sys; print(json.loads(sys.stdin.read())["project_name"])');
echo "**** create merged bin ****";
cd build && esptool.py --chip $IDF_TARGET merge_bin -o $IDF_PROJECT_NAME-merged.bin @flash_args && cd ..;
echo "**** copy artifacts ****";
mkdir -p ${{ inputs.artifacts_dir }};
cp -t ${{ inputs.artifacts_dir }} build/$IDF_PROJECT_NAME.bin build/$IDF_PROJECT_NAME-merged.bin;