Skip to content

Instantly share code, notes, and snippets.

@okbm
Created August 9, 2014 08:32
Show Gist options
  • Save okbm/1c0da4323515017b700c to your computer and use it in GitHub Desktop.
Save okbm/1c0da4323515017b700c to your computer and use it in GitHub Desktop.
#!/bin/sh
function print_help () {
cat <<__EOF__
Usage: sh $0
簡易デプロイシェル
1) git fetch -p && git checkout master && git pull
2) DocumentRoot以下にrsyncするだけ
Options
-h, --help show this message
__EOF__
}
# オプション解析
while getopts nt:vge:sqh OPT; do
case "$OPT" in
h|--help) print_help
exit 0
;;
esac
done
VERSION="1.0"
readonly GIT_REPO='/home/user/repository/git-hogehoge'
readonly DEPLOY_REPO='/var/www/html'
echo "cd $GIT_REPO"
cd $GIT_REPO
echo "git fetch -p && git checkout master && git pull"
git fetch -p
git reset --hard HEAD^
git checkout master
git pull
echo "rsync -aru $GIT_REPO/ $DEPLOY_REPO/"
rsync -aru $GIT_REPO/ $DEPLOY_REPO/
echo "deploy finish"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment