Hexo高效部署

开发:troy

注意事项

  • 请不要以root身份运行,否则会引起文件权限问题
  • 提示报错请停止并删除node_modules,检查log.txt 检查是不三该升级了 cnpm update * –save
  • 转载请注明原创,喜欢可价格好友多联系!
  • 请提前准备好heroku账号并登录
  • 请在提示时开启~~不要提前开启
  • 提示报错请停止并删除node_modules,检查log.txt
  • bug提交请联系troy@tx.zygd.site
  • windows nodebash暂未测试,理应可以
  • 请确表npm已换源,换源教程
  • heroku教程

主要产品:Gitee Github Coding Fast Heroku Vercel

安装方法请自行百度

其中 fast已经复制到桌面,直接使用

文件结构

blog【hexo自带结构,[coding_config.yml,gitee_config.yml,github_config.yml ...],index.php,composer.json】
log.txt
ysf@ysf:~/Documents/vercel-master$ ./hexo.sh
|欢迎使用hexo高效部署工具|
|请不要用root身份运行本程序,会导致文件夹权限问题|
|本程序将会在最后删除log.txt以维持仓库i同步,报错可以在cmd上观看|
|请准备按ctrl+c 撤销操作|
✔ Installed 22 packages
✔ Linked 0 latest versions
✔ Run 0 scripts
✔ All packages installed (used 24ms(network 21ms), speed 0B/s, json 0(0B), tarball 0B)
|初始化成功!|
INFO Deleted database.
INFO Deleted public folder.

|Gitee推送成功|

|Github推送成功|

|Coding推送成功|

|Fast推送成功|

|Heroku推送成功|

|任务圆满成功|
文件内容
echo "|欢迎使用hexo高效部署工具|"
echo "|请不要用root身份运行本程序,会导致文件夹权限问题|"
echo "|本程序将会在最后删除log.txt以维持仓库i同步,报错可以在cmd上观看|"
echo "|请准备按ctrl+c 撤销操作|"
sleep 5s
cnpm i || echo "|初始化失败|"
echo "|初始化成功!|"
mv gitee_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml gitee_config.yml
echo "|Gitee推送成功|"
mv github_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml github_config.yml
echo "|Github推送成功|"
echo "|清准备好登陆heroku|"
mv heroku_config.yml _config.yml || echo "移动文件出错" >> log.txt
heroku login || echo "登陆错误"
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml heroku_config.yml || echo "移动文件出错" >> log.txt
sudo rm -r .deploy_heroku || echo "|删除文件出错!|"
echo "|Heroku推送成功|"
mv coding_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml coding_config.yml
echo "|Coding推送成功|"
mv fast_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
rm -r ~/Desktop/public/
cp -r public ~/Desktop/ || echo "复制文件出错" >> log.txt
mv _config.yml fast_config.yml
echo "|Fast推送成功|"
mv vercel_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
mv _config.yml vercel_config.yml
sudo rm -r .deploy_git/
echo "|vercel 更新成功,正在删除缓存文件|"
rm -r log.txt
git add .
git commit -m "update"
git push || echo "推送文件出错" >> log.txt
echo "|Fast推送成功|"
echo "|任务圆满成功|"