arduino_esp32_a2dp/.drone.yml

92 lines
3.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
type: docker
name: build-and-release-esp32
trigger:
branch:
- main
- master
event:
- push
- pull_request
- tag
steps:
# --- 1. arduino-cli の準備、ボード・ライブラリ導入、ビルド ---
- name: build-firmware
image: python:3.11-slim
environment:
HOME: /root
commands:
- sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources && apt-get -o Acquire::Retries=5 update && apt-get install -y curl git
# arduino-cli のインストール
- curl -fsSL --ipv4 --connect-timeout 20 --retry 5 --retry-delay 5 --retry-all-errors https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz | tar -xz -C /usr/local/bin arduino-cli
- arduino-cli version
# esptool.py が必要とする Python モジュール
- pip install --no-cache-dir pyserial
# ESP32 パッケージインデックスの更新と 2.0.14 のインストール
- arduino-cli config init --overwrite
- 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
# ライブラリのインストール
- mkdir -p /root/Arduino/libraries
- git clone https://github.com/pschatzmann/ESP32-A2DP.git /root/Arduino/libraries/ESP32-A2DP
- arduino-cli lib install "U8g2"
- arduino-cli lib install "Adafruit AHTX0"
- arduino-cli lib install "BH1750"
- arduino-cli lib install "Adafruit NeoPixel"
# スケッチのコンパイル
- |
arduino-cli compile \
--fqbn "esp32:esp32:esp32:PartitionScheme=huge_app,FlashMode=dio,FlashSize=4M" \
--build-path build_temp \
--output-dir build \
firmware/firmware.ino
# バイナリファイル名の正規化 (リネーム)
- |
if [ -f build/firmware.ino.bootloader.bin ]; then
mv build/firmware.ino.bootloader.bin build/bootloader.bin
fi
if [ -f build/firmware.ino.partitions.bin ]; then
mv build/firmware.ino.partitions.bin build/partitions.bin
fi
if [ -f build/firmware.ino.bin ]; then
mv build/firmware.ino.bin build/firmware.bin
fi
# --- 2. flash.j-code.org/download へ成果物を公開 ---
# /publish はランナー設定(DRONE_RUNNER_VOLUMES)でホストの flash/download に紐付いている
# 公開先: /download/<リポジトリ名>/latest/ (ブランチPush時)、/download/<リポジトリ名>/<タグ>/ (タグ時)
- name: publish-to-flash
image: alpine:3
commands:
- |
if [ "$DRONE_BUILD_EVENT" = "tag" ]; then
DEST="/publish/$DRONE_REPO_NAME/$DRONE_TAG"
else
DEST="/publish/$DRONE_REPO_NAME/latest"
fi
mkdir -p "$DEST"
cp build/bootloader.bin build/partitions.bin build/firmware.bin "$DEST/"
chmod -R a+rX "/publish/$DRONE_REPO_NAME"
echo "公開先: https://flash.j-code.org/download/${DEST#/publish/}/"
when:
event:
- push
- tag
# --- 3. タグPush時(v*.*.*)に Gitea へリリース作成 & バイナリ添付 ---
- name: release-to-gitea
image: plugins/gitea-release
settings:
base_url: https://gitea.j-code.org
api_key:
from_secret: gitea_token # Drone Secrets に登録した Access Token
files:
- build/bootloader.bin
- build/partitions.bin
- build/firmware.bin
when:
event:
- tag