configure drone build
continuous-integration/drone/push Build is failing Details

This commit is contained in:
neri 2022-11-27 13:50:47 +01:00
parent ca59af3c62
commit 604e2b7e7b
4 changed files with 76 additions and 15 deletions

46
.drone.yml Normal file
View File

@ -0,0 +1,46 @@
kind: pipeline
type: docker
name: default
steps:
- name: configure
image: alpine
commands:
- sed -i "s/HOSTNAME/$HOSTNAME/" data/homie/config.json
- sed -i "s/WIFI_SSID/$WIFI_SSID/" data/homie/config.json
- sed -i "s/WIFI_PASS/$WIFI_PASS/" data/homie/config.json
- cat data/homie/config.json
environment:
HOSTNAME: esp-waehlscheibe
WIFI_SSID:
from_secret: wifi_ssid
WIFI_PASS:
from_secret: wifi_pass
- name: build
image: infinitecoding/platformio-for-ci:latest
commands:
- platformio --version
# Build image
- platformio run --environment d1_mini
# Build file system image
- platformio run --target buildfs --environment d1_mini
- name: find device ip
image: cburki/mosquitto-clients
commands:
- mosquitto_sub -h mqtt.ctdo.de -t "homie/$HOSTNAME/\$localip" -C 1 | tr -d '\n' | tee device_ip
environment:
HOSTNAME: esp-waehlscheibe
when:
branch:
- master
- name: upload
image: curlimages/curl
commands:
- echo "$PWD"
- ls -al ./drone
# Upload firmware
- ./drone/espota-deploy.sh "$device_ip" ".pio/build/d1_mini/firmware.bin"
# Upload file system
- ./drone/espota-deploy.sh "$device_ip" ".pio/build/d1_mini/spiffs.bin"
when:
branch:
- master

View File

@ -1,16 +1,16 @@
{ {
"name": "esp-waehlscheibe", "name": "HOSTNAME",
"device_id": "esp-waehlscheibe", "device_id": "HOSTNAME",
"wifi": { "wifi": {
"ssid": "CTDO-IoT", "ssid": "WIFI_SSID",
"password": "12345678" "password": "WIFI_PASS"
}, },
"mqtt": { "mqtt": {
"host": "mqtt.ctdo.de", "host": "mqtt.ctdo.de",
"port": 1883, "port": 1883,
"auth": false "auth": false
}, },
"ota": { "ota": {
"enabled": false "enabled": false
} }
} }

15
drone/espota-deploy.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/env sh
device_ip="$1"
file="$2"
curl \
--insecure \
--no-progress-meter \
--fail-with-body \
--request POST \
--url "https://espota.ctdo.de/" \
--header "Content-Type: multipart/form-data" \
--form ip="$device_ip" \
--form "firmware=@$file" \
--no-buffer

View File

@ -16,5 +16,5 @@ upload_speed = 1500000
monitor_speed = 115200 monitor_speed = 115200
lib_deps = lib_deps =
bblanchon/ArduinoJson bblanchon/ArduinoJson
me-no-dev/ESP Async WebServer@1.2.3
https://github.com/homieiot/homie-esp8266 https://github.com/homieiot/homie-esp8266
me-no-dev/ESP Async WebServer@1.2.3