esp-volumeknob/.drone.yml

51 lines
1.8 KiB
YAML

---
kind: pipeline
type: docker
name: default
steps:
- name: prereq
image: cburki/mosquitto-clients
commands:
- mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip
environment:
hostname:
from_secret: hostname
- name: build
image: eclipse/platformio
commands:
- sed -i data/homie/config.json "s/WIFISSID/$IOTSSID/"
- sed -i data/homie/config.json "s/WIFIPASS/$iotpwd/"
- sed -i data/homie/config.json "s/HOSTNAME/$hostname/g"
- sed -i data/homie/config.json "s/HOSTNAME/$hostname/g"
- lastknownip=$(cat lastknownip)
# - pip install -U platformio
# Build image
- platformio run --environment d1_mini
# Build file system image
- platformio run --target buildfs --environment d1_mini
# Upload image with espota-gateway
- |
curl -k --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form firmware=@.pio/build/d1_mini/firmware.bin -N
# TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough)
#- platformio run --target upload --environment d1_mini
# (Build if necessary and) Upload Filesystem Image (here: OTA)
# - platformio run --target uploadfs --environment d1_mini
environment:
hostname:
from_secret: hostname
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd
#- name: release
# image: python:3.10 # eclipse/platformio #
# commands:
# - pip install -U platformio
# - platformio run --target upload --environment d1_mini
# - platformio run --target uploadfs --environment d1_mini
### matrix-builds?
### https://0-8-0.docs.drone.io/matrix-builds/
###