esp-volumeknob/.drone.yml

53 lines
2.0 KiB
YAML
Raw Normal View History

2022-06-07 18:14:58 +00:00
---
kind: pipeline
type: docker
name: default
steps:
2022-06-30 12:29:02 +00:00
- name: fetch ip
image: cburki/mosquitto-clients
commands:
2022-08-16 19:10:00 +00:00
- mosquitto_sub -h raum.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip
- cat "lastknownip"
2022-06-30 12:29:02 +00:00
environment:
hostname:
from_secret: hostname
- name: configure
image: alpine
commands:
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
- lastknownip=$(cat lastknownip)
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
environment:
hostname:
from_secret: hostname
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd
- name: build
image: suculent/platformio-docker-build
commands:
# - pip install -U platformio
# Build image
- platformio run --environment d1_mini
# Build file system image
- platformio run --target buildfs --environment d1_mini
- name: upload
image: curlimages/curl
commands:
- lastknownip=$(cat lastknownip)
2022-08-16 19:10:00 +00:00
- echo "$lastknownip"
2022-06-30 12:29:02 +00:00
# Upload image with espota-gateway
- |
2022-08-16 19:10:00 +00:00
curl --insecure --no-progress-meter --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form firmware=@.pio/build/d1_mini/firmware.bin --no-buffer
2022-06-30 12:29:02 +00:00
# TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough)
- |
2022-08-16 19:10:00 +00:00
curl --insecure --no-progress-meter --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form spiffs=@.pio/build/d1_mini/spiffs.bin --no-buffer
2022-06-07 22:04:33 +00:00
2022-06-22 20:41:35 +00:00
### matrix-builds? - for multiple volumeknobs?
2022-06-07 22:04:33 +00:00
### https://0-8-0.docs.drone.io/matrix-builds/
2022-06-30 12:29:02 +00:00
###