Added deploy script.
This commit is contained in:
parent
b805d1b183
commit
bbf77c6b1e
37
deploy.sh
Executable file
37
deploy.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
|
||||
if ! git diff-index --quiet HEAD ; then
|
||||
echo "Git isn't clean. Cant deploy."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "Version to generate: " VERSION
|
||||
|
||||
OTA_VERSION=`grep "VERSION=" bin/update.manifest | cut -d"=" -f2`
|
||||
OTA_VERSION=$(( "$OTA_VERSION" + 1 ))
|
||||
echo "$OTA_VERSION" > data/_version.txt
|
||||
|
||||
sed -i.bak "s/#define OTA_VERSION .*/#define OTA_VERSION $OTA_VERSION/" include/config.h include/config.sample.h
|
||||
rm include/config.h.bak include/config.sample.h.bak
|
||||
|
||||
PLATFORMIO_BUILD_FLAGS='-DVERSION=\"$VERSION\"' pio run -e deploy -t buildprog || exit 1
|
||||
pio run -e deploy -t buildfs || exit 1
|
||||
|
||||
cp .pio/build/deploy/firmware.bin bin/firmware.bin || exit 1
|
||||
cp .pio/build/deploy/spiffs.bin bin/spiffs.bin || exit 1
|
||||
|
||||
sed -i.bak "s/VERSION=.*/VERSION=$OTA_VERSION/" bin/update.manifest
|
||||
MD5=`md5sum --binary bin/firmware.bin | cut -d" " -f1`
|
||||
sed -i.bak "s/IMAGE_MD5=.*/IMAGE_MD5=$MD5/" bin/update.manifest
|
||||
MD5=`md5sum --binary bin/spiffs.bin | cut -d" " -f1`
|
||||
sed -i.bak "s/SPIFFS_MD5=.*/SPIFFS_MD5=$MD5/" bin/update.manifest
|
||||
rm bin/update.manifest.bak
|
||||
|
||||
git diff
|
||||
exit 99
|
||||
|
||||
git add bin/firmware.bin bin/spiffs.bin bin/update.manifest
|
||||
git commit -m "Deploying version $VERSION."
|
||||
git tag -a -m "Deploying version $VERSION" $VERSION
|
@ -8,16 +8,29 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = esp32
|
||||
|
||||
[extra]
|
||||
lib_deps =
|
||||
63 ; MFRC522
|
||||
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
||||
ArduinoJSON
|
||||
6691 ; TinyXML
|
||||
|
||||
[env:esp32]
|
||||
platform = espressif32
|
||||
board = esp-wrover-kit
|
||||
framework = arduino
|
||||
upload_speed = 512000
|
||||
build_flags=!./build_version.sh
|
||||
lib_deps = MFRC522
|
||||
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
||||
ArduinoJSON
|
||||
6691 ; TinyXML
|
||||
lib_deps = ${extra.lib_deps}
|
||||
upload_port = /dev/cu.SLAB_USBtoUART
|
||||
monitor_speed = 74480
|
||||
;monitor_port = /dev/cu.wchusbserial1420
|
||||
|
||||
[env:deploy]
|
||||
platform = espressif32
|
||||
board = esp-wrover-kit
|
||||
framework = arduino
|
||||
lib_deps = ${extra.lib_deps}
|
||||
|
@ -1,5 +0,0 @@
|
||||
VERSION=1
|
||||
IMAGE_PATH=https://files.schle.nz/esmp3/firmware.bin
|
||||
IMAGE_MD5=ead8d94ae8a3c9f46e7ee65e2270fd69
|
||||
SPIFFS_PATH=https://files.schle.nz/esmp3/spiffs.bin
|
||||
SPIFFS_MD5=9f3902e3312863da8326e7fbe9485c9e
|
Loading…
Reference in New Issue
Block a user