使用bat脚本部署hexo到coding和github

因项目的不同适当的改造吧,本文以hexo为例。

拉取coding.net的代码和github的代码到本地

  1. 确保代码能够正常的运行,commit,push
  2. 在项目的目录外新建一个push.bat文件

快速预览

如何一步到位提交到仓库

脚本中的变量说明

  • artsPath 新增文章的目录
  • codingPath coding的目录
  • githubPath github的目录

复制文章然后自动执行命令进行部署

修改脚本中对应的路径后执行push

1
2
3
4
5
6
7
8
xcopy F:\CodingRepos\ymhexo\arts F:\CodingRepos\ymhexo\yimocoding\source\_posts /Y
cd F:\CodingRepos\ymhexo\yimocoding
call git pull
call hexo clean
call hexo d -g
call git add *
call git commit -m AddArticle
call git push

windows下使用bat脚本部署hexo到coding和github

拉取coding.net的代码和github的代码到本地

确保代码能够正常的运行,commit,push
新建一个push.bat文件
然后copy下面的代码再改改路径,将文章放到arts目录后运行push即可

  • artsPath 新增文章的目录
  • codingPath coding的目录
  • githubPath github的目录

如何一步到位提交到仓库

复制文章然后自动执行命令进行部署

修改脚本中对应的路径后执行push

1
2
3
4
5
6
7
8
xcopy F:\CodingRepos\ymhexo\arts F:\CodingRepos\ymhexo\yimocoding\source\_posts /Y
cd F:\CodingRepos\ymhexo\yimocoding
call git pull
call hexo clean
call hexo d -g
call git add *
call git commit -m AddArticle
call git push