Slides
| Key Slides |
|---|
| Full slide deck 🖼 |
| Outline 🗓 |
| Get started ☁️ or 💻 |
| Publishing 🚀 |
Activities
| Activity | Time |
|---|---|
| 📤 Your turn #1: Edit your index.Rmd YAML | 🕝 03:00 minutes |
| 📤 Your turn #2: Add new YAML metadata tags to your index.Rmd | 🕝 03:00 minutes |
| 📤 Your turn #3: Add/edit chapters in your book | 🕝 10:00 minutes |
| 📤 Your turn #4: Change how your sidebar TOC looks & works | 🕝 05:00 minutes |
| 📤 Your turn #5: Tune the book output & publish | 🕝 15:00 minutes |
Enable Continuous Integration with Travis-CI
In Travis:
- Enable continuous integration for your book’s GitHub repo on Travis
Modify
.gitignoreto include these files as “ignored” by Git:_book(unless you had changed the bookdown defaultoutput_dirto something else in your_bookdown.ymlfile)_bookdown_files
Add a file named
DESCRIPTION(no file extension needed)Package: placeholder Type: Book Title: Does not matter. Version: 0.0.1 Imports: bookdown, ggplot2 Remotes: rstudio/bookdownAdd a
.travis.ymlfile
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
language: R
sudo: false
cache:
packages: true
script:
- Rscript -e 'bookdown::render_book("index.Rmd", "bookdown::gitbook")'
deploy:
provider: pages
local_dir: _book
skip_cleanup: true
keep-history: true
github_token: $stat545_GITHUB_PAT
target_branch: gh-pages
You could now deploy this book either using GitHub Pages or Netlify.
Travis-CI to GitHub Pages
- In your repo on GitHub, go to Settings > GitHub Pages.
- For Source, choose
gh-pagesbranch.
Travis-CI to Netlify
- Log in to Netlify
- New Site from Git, select your repository
- From “Branch to deploy”, select
gh-pagesbranch. - Leave the basic build settings blank (build command and publish directory)
- This is because in our
.travis.yml, we setlocal_dir: _book. This means that we had Travis only push the rendered_bookdirectory to thegh-pagesbranch. Check it out in that branch in your GitHub repo! You’ll see all the files there that are present locally in your_bookfolder.
- This is because in our