js技术干货首页投稿(暂停使用,暂停投稿)

自动部署hexo生成的github博客

2017-10-08  本文已影响65人  aliyu

前言

不想用第三方的travis-ci实现自动部署博客,但是gitbub提供的钩子折腾了下,遇到了个坑。
休息的时候突然想了想,这个钩子其实就是在git push(或者其他操作)的时候触发自定义的命令而已。
其实我每写一篇文件发布,还需要运行hexo插件的一些操作。
为什么我不用shell做这些事情呢?

流程:

思路

#!/bin/bash
#By Ali 2017

#你博客静态文件所在文件夹
BLOG="../Ali1213.github.io";


rm -rf $BLOG/*  &&

hexo generate &&

git add . &&

git commit -a -m "auto commit by ali at `date +%Y%m%d`" &&

git push origin master &&

mv -f public/* $BLOG &&

cd  $BLOG &&

git add . &&

git commit -a -m "auto commit by ali at `date +%Y%m%d`" &&

git push origin master
上一篇 下一篇

猜你喜欢

热点阅读