在 Travis 上制作书籍并推回 GitHub 页
Build book on Travis and push back to GitHub pages
我正在使用托管在 GitHub 上的 bookdown
写一本书,一个令人沮丧的事情是我总是忘记在将我的更改推回到 GitHub 之前构建这本书。所以我想到的一个解决方案是使用 Travis 构建我的书并将其部署到 gh-pages
分支。我正在使用 htmlproofer
检查我书中的链接,所以我需要我的 Travis 构建使用 ruby
语言而不是 R
。但是,我看不到如何访问 Rscript
命令,因为它没有安装在环境中。我目前的.travis.yml
是
language: ruby
rvm:
- 2.3.3
before_script:
- chmod +x ./scripts/cibuild.sh
script:
- ./scripts/cibuild.sh
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
local_dir: docs
on:
branch: master
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
notifications:
email: false
sudo: false
其中 cibuild
只是一个包含
的 bash
脚本
#!/bin/sh
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"
htmlproofer ./docs
我尝试使用 sudo apt-get install r-base
但这给了我 R
版本 2.14.1
太旧了...
有什么想法吗?
为了解决这个问题,我切换到 language: R
构建,因为它也带有 Ruby。答案很详细here
我正在使用托管在 GitHub 上的 bookdown
写一本书,一个令人沮丧的事情是我总是忘记在将我的更改推回到 GitHub 之前构建这本书。所以我想到的一个解决方案是使用 Travis 构建我的书并将其部署到 gh-pages
分支。我正在使用 htmlproofer
检查我书中的链接,所以我需要我的 Travis 构建使用 ruby
语言而不是 R
。但是,我看不到如何访问 Rscript
命令,因为它没有安装在环境中。我目前的.travis.yml
是
language: ruby
rvm:
- 2.3.3
before_script:
- chmod +x ./scripts/cibuild.sh
script:
- ./scripts/cibuild.sh
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
local_dir: docs
on:
branch: master
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
notifications:
email: false
sudo: false
其中 cibuild
只是一个包含
bash
脚本
#!/bin/sh
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"
htmlproofer ./docs
我尝试使用 sudo apt-get install r-base
但这给了我 R
版本 2.14.1
太旧了...
有什么想法吗?
为了解决这个问题,我切换到 language: R
构建,因为它也带有 Ruby。答案很详细here