scratch/tasks/ghpublish
Yann Esposito (Yogsototh) 41584e59ed Debug mode
2011-04-20 15:41:34 +02:00

45 lines
1 KiB
Bash
Executable file

#!/usr/bin/env zsh
rootdir=$HOME/Sites/webroot
function debug {
print -- $*
eval $*
}
cd $rootdir || { print -- "Unable to go to $HOME/Sites/webroot"; exit 1 }
git co master || { exit 1 }
git pull || { exit 1 }
# empty regen depencies cache because of a bug
\rm -f ./tmp/*
./tasks/recompile
if git status | grep 'nothing to commit'>/dev/null 2>&1; then
else
git add .
git commit -m "regeneration"
fi
# update & push gh-pages
debug git co gh-pages
(( $? == 0 )) || { exit 1 }
debug \rm -rf *(N)
(( $? == 0 )) || { exit 1 }
debug git co master output
(( $? == 0 )) || { exit 1 }
debug git unstage output
debug mv output/index.html .
(( $? == 0 )) || { exit 1 }
debug mv output/n3blog/* .
(( $? == 0 )) || { exit 1 }
debug \rm -rf output
(( $? == 0 )) || { exit 1 }
debug cp en/error/404-not_found/index.html 404.html
(( $? == 0 )) || { exit 1 }
debug echo "yannesposito.com" > CNAME
(( $? == 0 )) || { exit 1 }
debug git add .
(( $? == 0 )) || { exit 1 }
debug git commit -m 'updated website'
(( $? == 0 )) || { exit 1 }
debug git push