#!/bin/bash
-# Identify the version numbers embedded in these components.
-# This is not very useful on its own. It will become part of a build system later.
-
-
+# Find the highest version number used in any component, increment it by one, and update
+# all components to use the new version number. Then generate a commit and a tag.
echo -e '\033[2J\033[H'
echo -e '\033[34m\033[1m'
-echo -e 'â\95\94â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\97'
-echo -e '║ UPDATE-O-VERSION-O-MATIC FOR CITADEL ║'
-echo -e 'â\95\9aâ\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\90â\95\9d'
+echo -e '╔════════════════════════════════════════╗'
+echo -e '║ PIPELINE-O-MATIC FOR CITADEL ║'
+echo -e '╚════════════════════════════════════════╝'
echo -e '\033[0m'
libcitadel_version=`grep LIBCITADEL_VERSION_NUMBER libcitadel/lib/libcitadel.h | sed s/"[^0-9.]"/""/g`
-citserver_version=`grep REV_LEVEL citadel/citadel.h | sed s/"[^0-9.]"/""/g`
+citserver_version=`grep REV_LEVEL citadel/server/citadel_defs.h | sed s/"[^0-9.]"/""/g`
webcit_version=`grep CLIENT_VERSION webcit/webcit.h | sed s/"[^0-9.]"/""/g`
+textclient_version=`grep CLIENT_VERSION textclient/textclient.h | sed s/"[^0-9.]"/""/g`
NEW_VERSION=${libcitadel_version}
if [ ${citserver_version} -gt ${NEW_VERSION} ] ; then
if [ ${webcit_version} -gt ${NEW_VERSION} ] ; then
NEW_VERSION=${webcit_version}
fi
+if [ ${textclient_version} -gt ${NEW_VERSION} ] ; then
+ NEW_VERSION=${textclient_version}
+fi
NEW_VERSION=`expr ${NEW_VERSION} + 1`
echo -e '\033[33m\033[1mlibcitadel \033[32m was version \033[33m'$libcitadel_version'\033[0m'
echo -e '\033[33m\033[1mcitserver \033[32m was version \033[33m'$citserver_version'\033[0m'
echo -e '\033[33m\033[1mwebcit \033[32m was version \033[33m'$webcit_version'\033[0m'
+echo -e '\033[33m\033[1mtextclient \033[32m was version \033[33m'$textclient_version'\033[0m'
echo -e '\033[33m\033[1mnew release\033[32m will be version \033[33m'$NEW_VERSION'\033[0m'
-
-echo -e ''
-echo -e '\033[37m\033[1mUpdating header files to reflect the new version number\033[0m'
echo -e ''
+#echo -e '\033[41m\033[37m\033[1m THIS WILL INITIATE THE RELEASE PIPELINE. \033[0m'
+echo -n 'Proceed (y/n) ? '
+read x
+
+if echo ${x} | egrep -i '^y' ; then
+ echo -e ''
+ echo -e '\033[37m\033[1mUpdating header files to reflect the new version number\033[0m'
+ echo -e ''
+else
+ echo 'Exiting'
+ exit 0
+fi
# Edit libcitadel.h to make it the new version
sed \
# Edit citadel.h to make it the new version
sed \
-i s/\#define.\*REV_LEVEL.\*${citserver_version}/\#define\ REV_LEVEL\ ${NEW_VERSION}/g \
- citadel/citadel.h
+ citadel/server/citadel_defs.h
# Edit webcit.h to make it the new version
sed \
-i s/\#define.\*CLIENT_VERSION.\*${webcit_version}/\#define\ CLIENT_VERSION\ ${NEW_VERSION}/g \
webcit/webcit.h
+# Edit textclient.h to make it the new version
+sed \
+ -i s/\#define.\*CLIENT_VERSION.\*${textclient_version}/\#define\ CLIENT_VERSION\ ${NEW_VERSION}/g \
+ textclient/textclient.h
+
libcitadel_version=`grep LIBCITADEL_VERSION_NUMBER libcitadel/lib/libcitadel.h | sed s/"[^0-9.]"/""/g`
-citserver_version=`grep REV_LEVEL citadel/citadel.h | sed s/"[^0-9.]"/""/g`
+citserver_version=`grep REV_LEVEL citadel/server/citadel_defs.h | sed s/"[^0-9.]"/""/g`
webcit_version=`grep CLIENT_VERSION webcit/webcit.h | sed s/"[^0-9.]"/""/g`
+textclient_version=`grep CLIENT_VERSION textclient/textclient.h | sed s/"[^0-9.]"/""/g`
echo -e '\033[33m\033[1mlibcitadel \033[32m is now version \033[33m'$libcitadel_version'\033[0m'
echo -e '\033[33m\033[1mcitserver \033[32m is now version \033[33m'$citserver_version'\033[0m'
echo -e '\033[33m\033[1mwebcit \033[32m is now version \033[33m'$webcit_version'\033[0m'
+echo -e '\033[33m\033[1mtextclient \033[32m is now version \033[33m'$textclient_version'\033[0m'
echo $NEW_VERSION >release_version.txt
git add release_version.txt
echo -e '\033[37m\033[1mGenerating a commit\033[0m'
echo -e ''
git commit -a -m "Release version ${NEW_VERSION} generated by do-release.sh"
-git tag -a v${NEW_VERSION} -m ${NEW_VERSION}
+git tag -a v${NEW_VERSION} -m "Version ${NEW_VERSION} release"
+
+echo -n 'git push...'
+git push
+echo
+
+echo -n 'git push --tags...'
+git push --tags
+echo
echo -e ''
-echo -e '\033[37m\033[1mFinished. Remember to push this commit.\033[0m'
+echo -e '\033[37mFinished.\033[0m'
echo -e ''
+