本地自动化部署网站
步骤
- source放入D盘(source为单独的git库)
- website放入D盘(为hexo项目文件夹)
- website目录下的source每次从1的远程仓库pull
- website下的source每次pull后删除title以【未完】开头的文件
- cd到website下hexo generate生成website下public文件夹
- cd到public文件夹下,将整个文件夹push到github page项目
- 完成!
本地sh
#!/bin/bash
cd d:
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
echo "current dir is ================>$SHELL_FOLDER"
cd source
time=$(date "+%Y-%m-%d %H:%M:%S")
echo $time
git status
git add .
git commit -m "modify ${time}"
git push
cd ..
SHELL_FOLDER2=$(cd "$(dirname "$0")";pwd)
echo "current dir is ================>$SHELL_FOLDER2"
cd website/source
SHELL_FOLDER3=$(cd "$(dirname "$0")";pwd)
echo "current dir is ================>$SHELL_FOLDER3"
git pull
find . -name "【未完】*" -exec rm -f {} \;
cd ..
hexo generate
cd public
SHELL_FOLDER4=$(cd "$(dirname "$0")";pwd)
echo "current dir is ================>$SHELL_FOLDER4"
git add .
git commit -m "modify ${time}"
git push
echo "Done!!!!!!"
配置Jenkins
脚踏实地 慢慢走