@echo off
setpan=.\public\
setrepo=git@blog:yi-Xu-0100/www.yixuju.cn.git
setbranch=master
setrepogit=.\www.yixuju.cn\
set"pangitinfo=%repogit%.git"setbakgitinfo=.\static\.git
:: Clean pubilc directoryifexist%pan%(echo"Clean public directory"rd /S /Q %pan%)else(echo"Can not find public directory"):: Backup gitinfoifexist%repogit%(echo"Find %repogit% directory and clean it"rd /S /Q %repogit%)echo"Git pull lastest gitinfo"
git clone %repo% --depth=1
echo"Backup gitinfo"call .\copyDirectory.bat %pangitinfo%%bakgitinfo%if%Error%==true exitecho"Clean %repogit% directory"rd /S /Q %repogit%:: Hugo for new siteecho"Hugo for new site"
hugo
ifexist%pan%(cd%pan%echo"Git add all and commit"ifexist .\.git (
git add --all
git commit -m "Update site at %time%"
git push -f origin %branch%:%branch% -v
)else(echo"Can not find .git directory, git push fail!"))else(echo"Can not find public directory, hugo fail!")pause