esp-volumeknob/.drone.yml

58 lines
1.9 KiB
YAML
Raw Normal View History

2022-06-07 18:14:58 +00:00
---
kind: pipeline
type: docker
name: default
steps:
2022-06-07 20:21:22 +00:00
- name: prereq
image: cburki/mosquitto-clients
commands:
2022-06-07 20:38:19 +00:00
- mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip
2022-06-07 20:23:30 +00:00
environment:
hostname:
from_secret: hostname
2022-06-07 18:14:58 +00:00
- name: build
image: python:3.10
2022-06-07 18:14:58 +00:00
commands:
2022-06-22 20:12:58 +00:00
- 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
2022-06-07 20:38:19 +00:00
- lastknownip=$(cat lastknownip)
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
- cat data/homie/config.json
- cat platformio.ini
- pip install -U platformio
2022-06-07 22:04:33 +00:00
# Build image
2022-06-07 19:52:07 +00:00
- platformio run --environment d1_mini
2022-06-22 17:10:05 +00:00
# Build file system image
- platformio run --target buildfs --environment d1_mini
2022-06-22 20:27:00 +00:00
environment:
hostname:
from_secret: hostname
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd
- name: upload
image: python:3.10
commands:
2022-06-22 17:10:05 +00:00
# Upload image with espota-gateway
2022-06-22 17:21:36 +00:00
- |
2022-06-22 19:28:45 +00:00
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
2022-06-22 17:10:05 +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)
#- platformio run --target upload --environment d1_mini
2022-06-07 22:04:33 +00:00
# (Build if necessary and) Upload Filesystem Image (here: OTA)
2022-06-22 17:10:05 +00:00
# - platformio run --target uploadfs --environment d1_mini
2022-06-22 20:27:00 +00:00
2022-06-07 21:24:28 +00:00
#- 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
2022-06-07 22:04:33 +00:00
### matrix-builds?
### https://0-8-0.docs.drone.io/matrix-builds/
###