smarter deploy script

This commit is contained in:
Xavier Léauté 2013-11-05 15:20:55 -08:00
parent 0627c74e0d
commit 6ee917b770
1 changed files with 11 additions and 14 deletions

View File

@ -1,21 +1,21 @@
#! /bin/bash -e #! /bin/bash -e
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
SCRIPT_DIR=`dirname $0`
pushd $SCRIPT_DIR
SCRIPT_DIR=`pwd`
popd
if [ -z ${1} ]; then if [ -z ${1} ]; then
pushd $SCRIPT_DIR VERSION=$(cat $SCRIPT_DIR/../../pom.xml | grep version | head -4 | tail -1 | sed 's_.*<version>\([^<]*\)</version>.*_\1_')
VERSION=`cat ../../pom.xml | grep version | head -4 | tail -1 | sed 's_.*<version>\([^<]*\)</version>.*_\1_'`
popd
else else
VERSION=${1} VERSION=${1}
fi fi
WORKING_DIR=/tmp/docs-deploy #if [ -z "$(git tag -l "druid-$VERSION")" ]
if [ -z "$(git tag -l "druid-$VERSION")" ] && [ "$VERSION" != "latest" ]; then
echo "Version tag does not exist: druid-$VERSION"
exit 1;
fi
echo Using Version[${VERSION}] WORKING_DIR=$(mktemp -d -t druid-docs-deploy)
echo Using Version [${VERSION}]
echo Script in [${SCRIPT_DIR}] echo Script in [${SCRIPT_DIR}]
echo Deploying to [${WORKING_DIR}] echo Deploying to [${WORKING_DIR}]
@ -37,11 +37,8 @@ BRANCH=docs-${VERSION}
pushd ${WORKING_DIR} pushd ${WORKING_DIR}
git checkout -b ${BRANCH} git checkout -b ${BRANCH}
git add . git add .
git commit -m "Deploy new docs version ${VERSION}" git commit -m "Deploy ${VERSION} docs"
git push origin ${BRANCH} git push origin ${BRANCH}
popd popd
rm -rf ${WORKING_DIR} rm -rf ${WORKING_DIR}