scratch/tasks/ghpublish
Yann Esposito (Yogsototh) 275781053c Modified path
2011-04-22 08:37:12 +02:00

55 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env zsh
rootdir=$HOME/Sites/webroot
function log {
print -P -- $*
}
function debug {
# print -- $*
eval $*
}
current_branch=$(git branch | egrep '^\*' | awk '{print $2}')
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/*(N)
./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
log "Update and push gh-pages"
debug git co gh-pages
(( $? == 0 )) || { exit 1 }
debug git pull
(( $? == 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/* .
(( $? == 0 )) || { exit 1 }
debug \rm -rf output
(( $? == 0 )) || { exit 1 }
debug cp Scratch/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 origin gh-pages:gh-pages
(( $? == 0 )) || { exit 1 }
debug git co $current_branch