Giter Site home page Giter Site logo

本博客是放在Hostker服务器的(国内访问GitHub的速度实在不敢恭维),Hostker的应用只支持git和ftp,而且他的git有点怪,每次都要clone然后再push上去才不会出现奇怪的东西,所以是用不了Hexo deploy了,所以想到 push 后通过 travis-ci 来自动git到Hostker上面,接下来就开工了…

Build Status smk17.cn

Hostker

​ Hostker是九零创新实验室做的服务器,我2012在他们弄了Hostker就开始用了,历经这么多年现在貌似只能是老用户可以用了,反正现在我是找不到注册入口了...

​ 所以如果你是Hostker的老用户也可以接下去看...

​ 在 我的应用列表 新建应用,成功后如下:新建应用

Travis CI

​ 使用 github 帐号登录 https://travis-ci.org/, 将博客项目(你的博客.github.io)开启,然后在项目下新建.travis.yml 配置文件,当 push 时 travis 自动读取这个配置文件来完成 hexo 的 generate 和 Push到Hostker应用上面,但是在Travis下不能输入任何字符,所以我们需要在Git地址的 URL 中包含用户名和密码,不过我们不可能把Git地址的 URL 直接放在.travis.yml 配置文件里面,那样任何人都可以有权限往你的Hostker应用提交代码,这是不安全的。

​ 不过我们可以在Travis下对应我们博客项目的setting界面设置对应的Environment Variables,然后在.travis.yml 配置文件使用该参数,那别人就看不到了。

{% qnimg 99/2.png title:smk17.github.io alt:smk17.github.io %}

完整的.travis.yml 配置:

language: node_js
node_js: stable
before_install:
- git config --global user.name "sengmitnick"
- git config --global user.email "[email protected]"
install:
- npm install hexo -g
- npm install hexo-deployer-git --save
- npm install
script:
- hexo clean
- git clone ${GH_REF} public
- cd ./public
- rm -fr !(.git)
- cd ../
- hexo g
after_script:
- cd ./public
- git add --all .
- git commit -m "updata website"
- git push -u origin master
branches:
  only:
  - blog-source

参考

Hexo 博客 travis-ci 自动部署到VPS

hexo+Travis-ci+github构建自动化博客

用 Travis CI 自動部署網站到 GitHub

—END

smk17's Projects

ant-design icon ant-design

An enterprise-class UI design language and React UI library

babel-plugin-custom-import icon babel-plugin-custom-import

It's a babel plugin to transform the ESM (`import`) syntax to your own call expression (e.g. `__my_require__()`) , in order to passby webpack's compiling.

charttext icon charttext

DoNet下使用Chart,代码设置并具备放大功能

cordova-plugin-qqsdk icon cordova-plugin-qqsdk

A Cordova wrapper around the Tencent QQ SDK for Android and iOS. Provides access to QQ ssoLogin, QQ Sharing, QQZone Sharing etc.

ileaf icon ileaf

An iOS VPN supports Shadowsocks, VMess, Trojan, WebSocket, TLS and more.

remax-iconfont-cli icon remax-iconfont-cli

在RemaxJs框架中使用iconfont图标,支持多端,支持多色彩,不依赖字体。

smol-dev icon smol-dev

the first library to let you embed a developer agent in your own app!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.