From f498995aee52cd47189714d6fe4e7ce727d76b38 Mon Sep 17 00:00:00 2001 From: Francois BIOT Date: Sun, 10 Sep 2023 19:54:35 +0200 Subject: [PATCH] Enhancement to bump version --- bump_version.sh | 14 +++++++++++++- src/TinyMqtt.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bump_version.sh b/bump_version.sh index 5086742..8d4545d 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -1,5 +1,11 @@ #!/bin/bash current_version=$(git describe --tags --abbrev=0) + +function error +{ + echo + echo "ERROR *** $1" +} if [ "$1" == "-d" ]; then do=0 shift @@ -15,9 +21,14 @@ if [ "$1" == "" ]; then echo " Current version: $current_version" echo else + tm=$(git status --porcelain -- src/TinyMqtt.h | wc -l) echo "Current version: ($current_version)" echo "New version : ($1)" echo "Take info from : library.properties" + if [ "$tm" == "1" ]; then + error "You cannot bump version if TinyMqtt.h is modified" + exit + fi echo -n "Do you want to proceed ? " read a if [ "$a" == "y" ]; then @@ -25,6 +36,7 @@ else grep $current_version library.properties if [ "$?" == "0" ]; then sed -i "s/$current_version/$1/" library.properties + sed -i "s/#define TINY_MQTT_REVISION/#define TINY_MQTT_REVISION \"$1\"/" src/TinyMqtt.h cp library.json.skeleton library.json while ifs= read -r line; do @@ -56,7 +68,7 @@ else git push --tags fi else - echo "Current version does not match library.property version, aborting" + error "Current version does not match library.property version, aborting" fi fi fi diff --git a/src/TinyMqtt.h b/src/TinyMqtt.h index 131e5dc..a4ba270 100644 --- a/src/TinyMqtt.h +++ b/src/TinyMqtt.h @@ -1,6 +1,8 @@ // vim: ts=2 sw=2 expandtab #pragma once +#define TINY_MQTT_REVISION "1.1.2" + #ifndef TINY_MQTT_DEBUG #define TINY_MQTT_DEBUG 0 #endif