.travis.yml
配置文件参考:
language: node_js
node_js: node
cache:
directories:
- node_modules
install:
- yarn
before_script:
- git config user.name "Travis-CI"
- git config user.email "willin@willin.org"
- git remote rm origin
- git remote add origin https://${GH_TOKEN}@${GH_REF}
- git checkout master
script: yarn start
after_success:
- git add -A .
- git commit -a -m "Travis-CI Deployed to Github"
- git push origin master
其中 GH_TOKEN
(Personal Access Token) 和 GH_REF
环境变量可以通过两种方式添加:
travis encrypt 'GH_TOKEN=xxxxxxxx'
的方式加密并添加到配置文件中(Ref: https://docs.travis-ci.com/user/encryption-keys/)另外, git 用户的邮箱决定了你的贡献度是否显示在 github 上,也可以随便写一个,如 deploy@travis-ci.org
。
Ref: https://docs.travis-ci.com/user/cron-jobs/
这样就会每隔 24h 执行一次,可以用来做一些数据的统计、网站的更新等,玩法看你有什么样的想法。
这里有一个我做的每天抓取 Github Trending 每日趋势记录的 Repo: https://github.com/willin/github-trending 可以参考一下。