Easily publish an R bookdown website with GitLab Pages
Overview: a simple workflow
- hosting a repository on
- adding a configuration file to the project
Host a project on
GitLab is a web-based
Git repository manager. Creating a new project on
GitLab is fairly intuitive for
GitLab users can create unlimitate private projects for free (see here).
GitLab also offers a continuous integration service (
GitLab CI) and a static websites hosting service (
GitLab Pages) in its free plan.1
These features are also present in the open source software
GitLab Community Edition (CE).
GitLab CI configuration file
Add the following
.gitlab-ci.yml file in the root of the project:
image: rocker/verse:3.4.1 pages: stage: deploy script: - Rscript -e "bookdown::render_book('index.Rmd', 'all', output_dir = 'public')" artifacts: paths: - public only: - master
For explanations, see section 1.1.
R Core Team. 2017. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Xie, Yihui. 2017. Bookdown: Authoring Books and Technical Documents with R Markdown. https://CRAN.R-project.org/package=bookdown.
CI pipelines are limited to 2,000 minutes per month↩