name: OTA build on: push: branches: - '**' workflow_dispatch: jobs: build-ota: runs-on: ubuntu-latest timeout-minutes: 45 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install PlatformIO run: | python -m pip install --upgrade pip pip install platformio - name: Build OTA firmware binaries run: pio run - name: Prepare direct OTA files run: | set -eu rm -rf dist/ota project_name="${GITHUB_REPOSITORY#*/}" project_name="${project_name#PlatformIO_}" timestamp="$(date -u +%Y-%m-%dT%H-%M-%SZ)" mkdir -p dist/ota found=0 for fw in .pio/build/*/firmware.bin .pio/build/*/firmware.hex; do [ -f "$fw" ] || continue env_name="$(basename "$(dirname "$fw")")" ext="${fw##*.}" cp "$fw" "dist/ota/${project_name}_${env_name}_${timestamp}.${ext}" found=1 done if [ "$found" -eq 0 ]; then echo 'No firmware.bin or firmware.hex artifacts were produced.' >&2 exit 1 fi find dist/ota -maxdepth 1 -type f | sort - name: Upload direct OTA files as artifacts uses: actions/upload-artifact@v3 with: name: ota-files path: dist/ota/* if-no-files-found: error