Skip to content

Instantly share code, notes, and snippets.

@loonies
Forked from zombor/kohana-release.sh
Created July 21, 2011 07:55
Show Gist options
  • Save loonies/1096758 to your computer and use it in GitHub Desktop.
Save loonies/1096758 to your computer and use it in GitHub Desktop.
Kohana Release Script - Bash script to do a kohana release from git.
#!/bin/bash
MAJOR_VERSION=$1
MINOR_VERSION=$2
if [ $# -lt 2 ]
then
echo "Usage: $0 <MAJOR-VERSION> <MINOR-VERSION>"
exit
fi
if ( [ ${#MAJOR_VERSION} -ge ${#MINOR_VERSION} ] || [ "$MAJOR_VERSION" != "${MINOR_VERSION:0:${#MAJOR_VERSION}}" ] )
then
echo "MAJOR-VERSION must be a prefix of MINOR-VERSION"
exit 1
fi
function update_cwd
{
git fetch
git checkout $MAJOR_VERSION/master
git submodule update
git merge origin/$MAJOR_VERSION/master
git checkout $MAJOR_VERSION/develop
git submodule update
git merge origin/$MAJOR_VERSION/develop
}
echo "Are you really prepared to release? This will create PRODUCTION RELEASE! (Y/N)"
read ready
case "$ready" in
Y*|y*)
# Continue!
;;
*)
echo "Aborted!"
exit 1
;;
esac
# Make sure we are completely up to date
update_cwd
# Start the release for kohana/kohana
git flow release start $MINOR_VERSION
# Do modules/*
find modules/* -maxdepth 0 -type d | while read -r dir
do
cd $dir
# Make sure we are completely up to date
update_cwd
# Start the release branch
git flow release start $MINOR_VERSION
echo "Please make sure that everything in ${dir} is ready for release, then hit <enter>:"
read ready
git flow release finish $MINOR_VERSION
# Push the changes
#git push origin-push ${MAJOR_VERSION}/develop
#git push origin-push ${MAJOR_VERSION}/master
cd -
git add $dir
done
# Do system/
find system -maxdepth 0 -type d | while read -r dir
do
cd $dir
# Make sure we are completely up to date
update_cwd
# Start the release branch
git flow release start $MINOR_VERSION
echo "Please make sure that everything in ${dir} is ready for release, then hit <enter>:"
read ready
git flow release finish $MINOR_VERSION
# Push the changes
#git push origin-push ${MAJOR_VERSION}/develop
#git push origin-push ${MAJOR_VERSION}/master
cd -
git add $dir
done
git commit -m "tracking submodules for ${MINOR_VERSION}"
git flow release finish $MINOR_VERSION
# Push the changes
#git push origin ${MAJOR_VERSION}/develop
#git push origin ${MAJOR_VERSION}/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment