Use Netlify to publish a bookdown book

tl;dr: I would like to use Netlify as an alternative to Travis + GitHub Pages to publish a bookdown book, but all the resources I can find -- mainly from @apreshill and @yihui show how to do it with blogdown not bookdown. Any advice or links to examples would be super helpful.

Background: I'm encountering the situation that @yihui describes in bookdown: Authoring Books with R Markdown (my bold):

"Basically, you compile the book to HTML, then run git commands to push the files to GitHub, but you probably do not want to do this over and over again manually and locally. It can be very handy to automate the publishing process completely on the cloud, so once it is set up correctly, all you have to do next is write the book and push the Rmd source files to GitHub, and your book will always be automatically built and published from the server side."

Source: https://bookdown.org/yihui/bookdown/github.html

Edit and update: My original understanding, which now appears to be wishful thinking, was that Netlify would eliminate the need for Travis to trigger a book rendering each time a change is pushed to an .Rmd file. Given that it appears that that is not the case (see the R Cookbook repo by Paul Teetor and JD Long and accompanying blog post), I wonder what the advantages are of Netlify vs. GitHub Pages for a bookdown book. I know that Netlify offers many features that GitHub Pages doesn't, but they don't seem particularly relevant for this use case. However, there's a lot of talk about Netlify so want to learn more.

Part of my problem is that the more I read about this the more I realize I don't fully understand how the terms continuous integration and continuous deployment are being used. On the features page referenced above, Netlify claims that GitHub Pages does not offer continuous deployment while Netlify does. I'm not sure what that actually means... when changes are made for example, to the /docs folder of a bookdown repo they are automatically published on GitHub Pages.

Thanks for helping me out of the muck.

2 Likes

Hey @jtr13!

You are right- it is not well documented. I actually have some draft materials on this topic for to add to the bookdown book, and would love feedback if you'd be willing to take them for a spin. If so, I'll message you the link, then I can update this thread when the instructions get merged into the online version of the book.

As a general bit of advice, you are right that "continuous deployment" in one sense means "keeping your GitHub source and your published site in sync", which happens with both basic Netlify and GitHub Pages when you push rendered bookdown files that you build locally up to a remote GitHub repository. But, if you want to both build then publish all in the cloud (essentially ignoring your local version of the built book), you will currently need to use Travis then either GitHub Pages or Netlify.

I have communicated with Netlify about the possibility of bypassing Travis and both building and deploying to Netlify with an R build command (not currently possible). They are open to including R as one of their supported languages for build commands, but would need to get a lot of community requests in their open GitHub issues.

Let me know if you are willing to review the draft sections on this this- I would really appreciate it!

Alison

4 Likes

Thank you! Yes, I would love to review the draft sections!

Too bad there doesn't seem to be a way around Travis yet. :cry:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.