Skip to content

Instantly share code, notes, and snippets.

@shama
Forked from rchavik/release.sh
Created September 2, 2012 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shama/3594707 to your computer and use it in GitHub Desktop.
Save shama/3594707 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.5
# location of working repositories
CAKE_REPO=/Users/kyle/Documents/www/cake/
CROOGO_REPO=/Users/kyle/Documents/www/croogo/app/
# release output dir
OUTPUT_DIR=/Users/kyle/Documents/www/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
;;
*)
echo "Unknown version"
exit 1
esac;
(
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
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