3.5 GitLab Pages
GitLab (http://gitlab.com) is a very popular way to host the source code of your project. GitLab has a built in Continuous Integration & Deployment (CI/CD) service that can be used to host static websites, named GitLab Pages. The major advantage of using GitLab Pages is that you will be able to compile all your Rmd posts through its CI/CD service instead of your local computer and any generated content, such as HTML files, will be automatically copied to the web server. Please note that this approach has similar issues as the Travis + GitHub approach in Section 3.4.
GitLab’s CI/CD service uses the instructions stored in the YAML file
.gitlab-ci.yml in the repository. Here is a sample configuration file
.gitlab-ci.yml from the example repository https://gitlab.com/rgaiacs/blogdown-gitlab:
image: debian:buster-slim before_script: - apt-get update && apt-get -y install pandoc r-base - R -e "install.packages('blogdown',repos='http://cran.rstudio.com')" - R -e "blogdown::install_hugo()" pages: script: - R -e "blogdown::build_site()" artifacts: paths: - public only: - master
image option specifies what Docker image will be use as a start point. We are using a Debian image but any image from Docker Hub can be used. Other settings and options are similar to
.travis.yml in Section 3.4. The above example generates the website at https://rgaiacs.gitlab.io/blogdown-gitlab.