Skip to content

Commit

Permalink
Enhancement to bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
hsaturn committed Sep 10, 2023
1 parent 8e44e61 commit f498995
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bump_version.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,16 +21,22 @@ 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
echo "Doing this..."
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
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/TinyMqtt.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f498995

Please sign in to comment.