本地自动化部署网站

步骤

  1. source放入D盘(source为单独的git库)
  2. website放入D盘(为hexo项目文件夹)
  3. website目录下的source每次从1的远程仓库pull
  4. website下的source每次pull后删除title以【未完】开头的文件
  5. cd到website下hexo generate生成website下public文件夹
  6. cd到public文件夹下,将整个文件夹push到github page项目
  7. 完成!

本地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

上一篇:配置WebSite的IIS时遇到的问题与解决方法


下一篇:重构经历(一)