From 7a20cf4b04a81b715401eddd618e816a5810a96c Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Fri, 29 Nov 2019 05:29:01 +0100 Subject: [PATCH] Better deploy script. --- DEPLOY.md | 8 +------- deploy.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DEPLOY.md b/DEPLOY.md index 75dab17..6120bc0 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -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`. diff --git a/deploy.sh b/deploy.sh index e13af7c..3ec8bca 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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