本地自動化部署網站

步驟

  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

相關文章
相關標籤/搜索