Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
multi branch version bumping script
Browse files Browse the repository at this point in the history
  • Loading branch information
German Tischler committed Jul 19, 2014
1 parent 4f087c6 commit e5d5dea
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions bumpversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,61 @@ SECOND=`echo $VERSION | awk -F'.' '{print $2}'`
THIRD=`echo $VERSION | awk -F'.' '{print $3}'`
NEXTTHIRD=`expr ${THIRD} + 1`

awk -v first=${FIRST} -v second=${SECOND} -v third=${THIRD} '/^AC_INIT/ {gsub(first"."second"."third,first"."second"."third+1);print} ; !/^AC_INIT/{print}' < configure.ac | \
awk -v first=${FIRST} -v second=${SECOND} -v third=${THIRD} '/^LIBRARY_VERSION=/ {gsub("="first"."third"."second,"="first":"third+1":"second);print} ; !/^LIBRARY_VERSION=/{print}' \
> configure.ac.tmp
function cleanup
{
if [ ! -z "${COMMITFILE}" ] ; then
if [ -f "${COMMITFILE}" ] ; then
rm -f "${COMMITFILE}"
fi
fi
}

COMMITFILE=commit_msg_$$.txt

trap cleanup EXIT SIGINT SIGTERM

# make sure we have the latest version
git checkout experimental
git pull

# create commit log message
joe "${COMMITFILE}"

if [ ! -s "${COMMITFILE}" ] ; then
echo "Empty commit log, aborting"
exit 1
fi

# update to next minor version
awk -v first=${FIRST} -v second=${SECOND} -v third=${THIRD} '/^AC_INIT/ {gsub(first"."second"."third,first"."second"."third+1);print} ; !/^AC_INIT/{print}' < configure.ac > configure.ac.tmp
mv configure.ac.tmp configure.ac

# commit file
git add configure.ac
git commit -F "${COMMITFILE}"
git push

# switch to experimental debian branch
git checkout experimental-debian
git pull
git merge experimental

# create change log message
pushd debian
export DEBEMAIL=gt1@sanger.ac.uk
export DEBFULLNAME="German Tischler"
# dch --distribution unstable -v ${FIRST}.${SECOND}.${NEXTTHIRD}-0
dch --distribution unstable -v ${FIRST}.${SECOND}.${NEXTTHIRD}
dch --release
# dch --release -v ${FIRST}.${SECOND}.${NEXTTHIRD}-1
popd

git add debian/changelog
git add configure.ac
git commit
git commit -F "${COMMITFILE}"
git push

# back to experimental branch
git checkout experimental

TAG=biobambam_experimental_${FIRST}_${SECOND}_${NEXTTHIRD}
git tag -a ${TAG} -m "biobambam experimental version ${FIRST}_${SECOND}_${NEXTTHIRD}"
git push origin ${TAG}

exit 0

0 comments on commit e5d5dea

Please sign in to comment.