Giter Site home page Giter Site logo

hacking-travis's Introduction

% Hacking Travis % TANG ZhiXiong % 2016-03-21

Hacking Travis

Build Status

这个 repo 展示了如何用 travis 自动把本文件用 pandoc 转换,然后上载到自己的七牛云盘中。

这是 pandoc 格式的 Markdown,GitHub 上显示得可能不好,请到 http://whudoc.qiniudn.com/travis/index.html 查看效果。

首先新建一个 conf.json.in:

{
    "src": "publish",
    "dest":  "qiniu:access_key=QiNiuAK&secret_key=QiNiuSK&bucket=whudoc&key_prefix=travis/",
    "debug_level": 1
}

里面的 QiNiuAKQiNiuSK 后面会被自动提换成自己的真实 key 值,生成 conf.json 文件,用于同步文件到七牛。

然后,用 GitHub 登录 https://travis-ci.org,把自己的 repo 设置为需要 travis 处理。然后在 GitHub 里加上一个 .travis.yml 文件,放入下面的内容:

sudo: required

before_install:
  - cd ~
  - wget https://github.com/jgm/pandoc/releases/download/1.17/pandoc-1.17-1-amd64.deb
  - sudo dpkg -i pandoc*.deb

script:
  - wget http://devtools.qiniu.com/qiniu-devtools-linux_amd64-current.tar.gz
  - tar xfz qiniu-devtools-linux_amd64-current.tar.gz
  - git clone https://github.com/district10/hacking-travis.git
  - cd hacking-travis
  - mkdir publish
  - pandoc -S -s --ascii -c http://tangzx.qiniudn.com/main.css --highlight-style pygments -f markdown+east_asian_line_breaks README.md -o publish/index.html
  - cat conf.json.in | sed -e "s/QiNiuAK/$QiNiuAK/" | sed -e "s/QiNiuSK/$QiNiuSK/" > conf.json
  - ../qrsync conf.json

说明:

  • pandoc{.bash} 要用 1.16+ 的版本,所以自己装。因为用了 east_asian_line_breaks 扩展
  • 同步到七牛,所以下载 qiniu-devtools-linux_amd64-amd64-current.tar.gz,里 面的 $QiNiuAK{.bash},$QiNiuSK{.bash} 在 travis 里环境变量里设置,这两个值用 sed{.bash} 来替换。

Pandoc 的参数:(这也是我自己 博客 的设置)

pandoc -S -s --ascii -c http://tangzx.qiniudn.com/main.css \
        --highlight-style pygments \
        -f markdown+east_asian_line_breaks README.md \
        -o publish/index.html

然后到 trivis 去设置那两个环境变量。最后 push 到 GitHub 就可以了。


十分感谢 billryanhow did you sync to qiniu? · Issue #83 · billryan/algorithm-exercise


不能翻墙的时候帮我 fetch 点文件,也是不错的:

origin backup
https://github.com/jgm/pandoc/releases/download/1.17.0.1/pandoc-1.17.0.1-1-amd64.deb http://tangzx.qiniudn.com/travis/pandoc-1.17.0.1-1-amd64.deb
https://github.com/jgm/pandoc/releases/download/1.17.0.1/pandoc-1.17.0.1-windows.msi http://tangzx.qiniudn.com/travis/pandoc-1.17.0.1-windows.msi
https://github.com/jgm/pandoc/releases/download/1.17.0.1/pandoc-1.17.0.1-osx.pkg http://tangzx.qiniudn.com/travis/pandoc-1.17.0.1-osx.pkg

hacking-travis's People

Contributors

dvorak4tzx avatar district10 avatar

Stargazers

itfanr avatar xunsyn avatar  avatar

Watchers

James Cloos avatar  avatar

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.