Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dgageot
Forked from emmanuelbernard/build.sh
Created November 5, 2010 15:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgageot/664291 to your computer and use it in GitHub Desktop.
Save dgageot/664291 to your computer and use it in GitHub Desktop.
#!/bin/bash
#run ./build.sh on another terminal window
#it will clone your existing repo and run the maven tests off this clone
#the branch tests are run from is the current branch
#
# ./build.sh
#the cloned repo will live in ../DIRECTORY_ROOT/REPO_DIRECTORY
DIRECTORY_ROOT="../privatebuild/"
#get the lastest part of the directory name
IFS="/"
SPLIT_DIR=(`pwd`)
SIZE=${#SPLIT_DIR[@]}
let LAST_INDEX=$SIZE-1
DIRECTORY_SUFFIX=${SPLIT_DIR[$LAST_INDEX]}
IFS=""
DIRECTORY="${DIRECTORY_ROOT}${DIRECTORY_SUFFIX}"
BRANCH=`git branch | grep "*" | awk '{print $NF}'`
#fresh clone
rm -Rf $DIRECTORY
git clone -slb "$BRANCH" . $DIRECTORY
cd $DIRECTORY
echo ""
echo "***** Working on branch $BRANCH *****"
echo ""
if [ -e "pom.xml" ]; then
mvn clean install
if [ $? -eq 0 ]; then
echo "Build results"
# git push $REMOTE_REPO master
else
echo "Unable to build"
exit $?
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment