The normal workflow for this is something like:
- Make updates to the package.
pkgdown::build_site()to generate the website files into a
- Commit changes and upload to GitHub.
- Use GitHub Pages, configured to source the files from the
docsfolder on the master branch.
But we’re programmers, so why can’t we automate the steps of 2-4? Luckily, there is a guide for this already.
One issue that I ran into is that some of the documentation is built using the current package, which isn’t installed by default in the Travis CI instance. (i.e. when Travis runs through the
R CMD CHECK, it installs the package temporarily, but that does not stick around) Thus, I ran into errors when
pkgdown tried to compile my
README.Rmd, which contained an example of using the package, as well as the vignettes.
My solution to this was simple, include a line before running
pkgdown::build_site() that installs the package. I ended up with this following segment of my
after_success: - R CMD INSTALL . - Rscript -e 'pkgdown::build_site()'
and after changing over my GitHub Pages setting to look in the
gh-pages branch, everything was set!