Skip to content

Instantly share code, notes, and snippets.

@rchavik
Created April 23, 2012 02:36
Show Gist options
  • Save rchavik/2468429 to your computer and use it in GitHub Desktop.
Save rchavik/2468429 to your computer and use it in GitHub Desktop.
Croogo Release Helper script to create a zipball from a tag
#!/bin/bash
# which cake version that will be bundled in the zip file
CAKE_13_STABLE=1.3.15
CAKE_21_STABLE=2.1.4
CAKE_23_LATEST=2.3.0-RC1
# location of working repositories
CAKE_REPO=~/work/core/cake_2.0/
CROOGO_REPO=~/work/personal/deploy/croogo/
# release output dir
OUTPUT_DIR=~/work/personal/deploy/croogo-releases
if [ -z $1 ]; then
echo "Missing release version."
exit 1
fi
VERSION=$1
RELEASE_DIR="croogo-$VERSION"
if [ -d $OUTPUT_DIR/$RELEASE_DIR ] ; then
echo "Target release directory already exists"
exit 1
fi
git --git-dir=$CROOGO_REPO/.git describe v$VERSION 2> /dev/null
VALID_TAG=$?
if [ $VALID_TAG -ne 0 ] ; then
echo "Invalid release version"
exit 1
fi
git --git-dir=$CROOGO_REPO/.git tag -v v$VERSION
VERIFIED_TAG=$?
if [ $VERIFIED_TAG -ne 0 ] ; then
echo -n "Note: Tag v$VERSION not verified. Continue with release? [Y|N] "
read CONTINUE
if [ "$CONTINUE" != "Y" ] || [ -z "$CONTINUE" ] ; then
echo "Aborted"
exit 1
fi
fi
case "$VERSION" in
1.3.*)
CAKE_VERSION=$CAKE_13_STABLE
CAKE_TEST=cake/tests
;;
1.4.*)
CAKE_VERSION=$CAKE_21_STABLE
CAKE_TEST=lib/Cake/Test
;;
1.5.*)
CAKE_VERSION=$CAKE_23_LATEST
CAKE_TEST=lib/Cake/Test
;;
*)
echo "Unknown version"
exit 1
esac;
(
cd $CROOGO_REPO
make clean
make
cd $OUTPUT_DIR
git --git-dir=$CAKE_REPO/.git archive --prefix $RELEASE_DIR/ $CAKE_VERSION \
| tar xfv -
rm -rf $RELEASE_DIR/$CAKE_TEST
rm -rf $RELEASE_DIR/app
git --git-dir=$CROOGO_REPO/.git archive --prefix app/ v$VERSION | \
tar xfvC - $RELEASE_DIR
if [ "$VERSION" = "1.5.0" ] ; then
git --git-dir=$CROOGO_REPO/Plugin/Search/.git archive --prefix Plugin/Search/ 0bf6246ee79e5be03359bcf6e9c78006ceffff03 | \
tar xfvC - $RELEASE_DIR/app/
rm -rf $RELEASE_DIR/app/Plugin/Search/Test
git --git-dir=$CROOGO_REPO/Plugin/Migrations/.git archive --prefix Plugin/Migrations/ f935fec98d2c0a8e1e7c13e6232d4949e9689e5c | \
tar xfvC - $RELEASE_DIR/app/
rm -rf $RELEASE_DIR/app/Plugin/Migrations/Test
cp -p $CROOGO_REPO/webroot/css/croogo-bootstrap*css $RELEASE_DIR/app/webroot/css/
cp -p $CROOGO_REPO/webroot/js/croogo-bootstrap*js $RELEASE_DIR/app/webroot/js/
cp -pR $CROOGO_REPO/webroot/font/ $RELEASE_DIR/app/webroot/font
fi
zip -r $RELEASE_DIR.zip $RELEASE_DIR
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment