Better deploy script.

This commit is contained in:
Fabian Schlenz 2019-11-29 05:29:01 +01:00
parent bbf77c6b1e
commit 7a20cf4b04
2 changed files with 15 additions and 8 deletions

View File

@ -1,9 +1,3 @@
# Deploying a new version
* Update the OTA_VERSION in `include/config.h`, `include/config.sample.h`,
`data/_version.txt`, and `update.manifest`.
* Commit the changes.
* Tag the commit with the new version string.
* Push everything.
* Create theimages using `pio run` and `pio run -t buildfs`.
* Upload `update.manifest`, `firmware.bin` and `spiffs.bin`.
* Use `deploy.sh`.

View File

@ -7,6 +7,15 @@ if ! git diff-index --quiet HEAD ; then
exit 1
fi
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
if [ "$branch_name" != "master" ]; then
echo "We are not on master branch. Can't deploy."
exit 1
fi
read -p "Version to generate: " VERSION
OTA_VERSION=`grep "VERSION=" bin/update.manifest | cut -d"=" -f2`
@ -29,9 +38,13 @@ 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
echo; echo; echo; echo; echo
echo "Please check the git diff, if everything looks okay:"
git diff
exit 99
read -p "Press ENTER to continue, Ctrl-C to abort. " foo
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
git push --follow-tags