77 lines
2.6 KiB
YAML
77 lines
2.6 KiB
YAML
name: Build and Release ESP32 Firmware
|
||
|
||
on:
|
||
push:
|
||
branches: [ "main", "master" ]
|
||
tags:
|
||
- "v*.*.*"
|
||
pull_request:
|
||
branches: [ "main", "master" ]
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
jobs:
|
||
build:
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
|
||
# 公式のアクションで arduino-cli をセットアップ
|
||
- name: Setup Arduino CLI
|
||
uses: arduino/setup-arduino-cli@v2
|
||
|
||
# ESP32 パッケージインデックスの更新と 2.0.14 のインストール
|
||
- name: Install ESP32 Board Core (2.0.14)
|
||
run: |
|
||
arduino-cli config init
|
||
arduino-cli config set board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
||
arduino-cli core update-index
|
||
arduino-cli core install esp32:esp32@2.0.14
|
||
|
||
# ESP32-A2DP ライブラリを GitHub から直接インストール
|
||
- name: Install ESP32-A2DP library from GitHub
|
||
run: |
|
||
mkdir -p ~/Arduino/libraries
|
||
git clone https://github.com/pschatzmann/ESP32-A2DP.git ~/Arduino/libraries/ESP32-A2DP
|
||
|
||
# コンパイル実行 (出力先ディレクトリを build に明示固定)
|
||
- name: Compile Sketch
|
||
run: |
|
||
arduino-cli compile \
|
||
--fqbn esp32:esp32:esp32 \
|
||
--build-property "build.partitions=huge_app" \
|
||
--build-property "upload.maximum_size=3145728" \
|
||
--build-property "build.flash_mode=dio" \
|
||
--build-property "build.flash_freq=40m" \
|
||
--build-property "build.flash_size=4MB" \
|
||
--build-path build \
|
||
firmware/firmware.ino
|
||
|
||
# build 配下のファイル一覧を txt に書き出す
|
||
- name: Write build file list
|
||
run: |
|
||
echo "Build directory listing for $(date)" > build/file_list.txt
|
||
# 再帰的にディレクトリ構造を含めて一覧を出力(build/ 以下を相対パスで表示)
|
||
find build -print | sed 's|^build/||' | sort >> build/file_list.txt
|
||
|
||
# 通常の Artifacts 保存 (build フォルダ内を保存)
|
||
- name: Upload Build Artifacts
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: esp32-a2dp-firmware
|
||
path: |
|
||
build/*.bin
|
||
build/file_list.txt
|
||
|
||
# GitHub Release の自動作成 & アセット添付 (タグ Push 時のみ)
|
||
- name: Create GitHub Release
|
||
if: startsWith(github.ref, 'refs/tags/')
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
files: build/*.bin
|
||
generate_release_notes: true
|