Blinky/.drone.yml

57 lines
2.1 KiB
YAML
Raw Normal View History

2022-08-30 15:50:09 +00:00
---
kind: pipeline
type: docker
name: default
steps:
- name: fetch ip
image: cburki/mosquitto-clients
commands:
2022-08-30 16:07:19 +00:00
- echo "Hostname is ---${HOST}--- $HOST ... \$HOST ... \${HOST} +++ $\{HOST\}"
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n'
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n' >lastknownip
2022-08-30 15:50:09 +00:00
- cat "lastknownip"
- name: configure
image: alpine
commands:
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
2022-08-30 16:07:19 +00:00
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
2022-08-30 15:50:09 +00:00
- lastknownip=$(cat lastknownip)
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
environment:
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)
- echo "$lastknownip"
# Upload image with espota-gateway
- |
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
# TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough)
- |
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
### matrix-builds? - for multiple volumeknobs?
### https://0-8-0.docs.drone.io/matrix-builds/
###
matrix:
2022-08-30 16:03:36 +00:00
include:
2022-08-30 16:07:19 +00:00
HOST:
2022-08-30 16:03:36 +00:00
- blinky1
- blinky2