3 # Find the highest version number used in any component, increment it by one, and update
4 # all components to use the new version number. Then generate a commit and a tag.
6 echo -e '\033[2J\033[H'
7 echo -e '\033[34m\033[1m'
8 echo -e '╔════════════════════════════════════════╗'
9 echo -e '║ PIPELINE-O-MATIC FOR CITADEL ║'
10 echo -e '╚════════════════════════════════════════╝'
13 libcitadel_version=`grep LIBCITADEL_VERSION_NUMBER libcitadel/lib/libcitadel.h | sed s/"[^0-9.]"/""/g`
14 citserver_version=`grep REV_LEVEL citadel/server/citadel_defs.h | sed s/"[^0-9.]"/""/g`
15 webcit_version=`grep CLIENT_VERSION webcit/webcit.h | sed s/"[^0-9.]"/""/g`
16 textclient_version=`grep CLIENT_VERSION textclient/textclient.h | sed s/"[^0-9.]"/""/g`
18 NEW_VERSION=${libcitadel_version}
19 if [ ${citserver_version} -gt ${NEW_VERSION} ] ; then
20 NEW_VERSION=${citserver_version}
22 if [ ${webcit_version} -gt ${NEW_VERSION} ] ; then
23 NEW_VERSION=${webcit_version}
25 if [ ${textclient_version} -gt ${NEW_VERSION} ] ; then
26 NEW_VERSION=${textclient_version}
28 NEW_VERSION=`expr ${NEW_VERSION} + 1`
30 echo -e '\033[33m\033[1mlibcitadel \033[32m was version \033[33m'$libcitadel_version'\033[0m'
31 echo -e '\033[33m\033[1mcitserver \033[32m was version \033[33m'$citserver_version'\033[0m'
32 echo -e '\033[33m\033[1mwebcit \033[32m was version \033[33m'$webcit_version'\033[0m'
33 echo -e '\033[33m\033[1mtextclient \033[32m was version \033[33m'$textclient_version'\033[0m'
34 echo -e '\033[33m\033[1mnew release\033[32m will be version \033[33m'$NEW_VERSION'\033[0m'
36 #echo -e '\033[41m\033[37m\033[1m THIS WILL INITIATE THE RELEASE PIPELINE. \033[0m'
37 echo -n 'Proceed (y/n) ? '
40 if echo ${x} | egrep -i '^y' ; then
42 echo -e '\033[37m\033[1mUpdating header files to reflect the new version number\033[0m'
49 # Edit libcitadel.h to make it the new version
51 -i s/\#define.\*LIBCITADEL_VERSION_NUMBER.\*${libcitadel_version}/\#define\ LIBCITADEL_VERSION_NUMBER\ ${NEW_VERSION}/g \
52 libcitadel/lib/libcitadel.h
54 # Edit citadel.h to make it the new version
56 -i s/\#define.\*REV_LEVEL.\*${citserver_version}/\#define\ REV_LEVEL\ ${NEW_VERSION}/g \
57 citadel/server/citadel_defs.h
59 # Edit webcit.h to make it the new version
61 -i s/\#define.\*CLIENT_VERSION.\*${webcit_version}/\#define\ CLIENT_VERSION\ ${NEW_VERSION}/g \
64 # Edit textclient.h to make it the new version
66 -i s/\#define.\*CLIENT_VERSION.\*${textclient_version}/\#define\ CLIENT_VERSION\ ${NEW_VERSION}/g \
67 textclient/textclient.h
69 libcitadel_version=`grep LIBCITADEL_VERSION_NUMBER libcitadel/lib/libcitadel.h | sed s/"[^0-9.]"/""/g`
70 citserver_version=`grep REV_LEVEL citadel/server/citadel_defs.h | sed s/"[^0-9.]"/""/g`
71 webcit_version=`grep CLIENT_VERSION webcit/webcit.h | sed s/"[^0-9.]"/""/g`
72 textclient_version=`grep CLIENT_VERSION textclient/textclient.h | sed s/"[^0-9.]"/""/g`
74 echo -e '\033[33m\033[1mlibcitadel \033[32m is now version \033[33m'$libcitadel_version'\033[0m'
75 echo -e '\033[33m\033[1mcitserver \033[32m is now version \033[33m'$citserver_version'\033[0m'
76 echo -e '\033[33m\033[1mwebcit \033[32m is now version \033[33m'$webcit_version'\033[0m'
77 echo -e '\033[33m\033[1mtextclient \033[32m is now version \033[33m'$textclient_version'\033[0m'
79 echo $NEW_VERSION >release_version.txt
80 git add release_version.txt
82 echo -e '\033[37m\033[1mUpdating release_version.txt to indicate version '${NEW_VERSION}'\033[0m'
83 echo -e '\033[37m\033[1mGenerating a commit\033[0m'
85 git commit -a -m "Release version ${NEW_VERSION} generated by do-release.sh"
86 git tag -a v${NEW_VERSION} -m "Version ${NEW_VERSION} release"
92 echo -n 'git push --tags...'
97 echo -e '\033[37mFinished.\033[0m'