Learn R Programming

googleCloudRunner (version 0.2.0)

cr_deploy_git_html: Deploy HTML built from a repo each commit (Experimental)

Description

This lets you set up triggers that will update a website each commit. You need to mirror the GitHub/Bitbucket repo onto Google Cloud Repositories for this to work.

Usage

cr_deploy_git_html(
  x,
  image = paste0(x, "-html"),
  rmd_folder = NULL,
  html_folder = NULL,
  branch = ".*",
  image_tag = "$SHORT_SHA",
  github_tag = NULL,
  timeout = 600L,
  edit_r = NULL,
  r_image = "gcr.io/gcer-public/packagetools:master",
  allowUnauthenticated = TRUE,
  region = cr_region_get(),
  projectId = cr_project_get()
)

Arguments

x

The GitHub repo e.g. MarkEdmondson1234/googleCloudRunner

image

The name of the image you want to build

rmd_folder

A folder of Rmd files within GitHub source that will be built into HTML for serving via render

html_folder

A folder of html to deploy within GitHub source. Will be ignored if rmd_folder is not NULL

branch

A regex of the GitHub branches that will trigger a build

image_tag

What to tag the build docker image

github_tag

Regexes matching what tags to build. If not NULL then argument branch will be ignored

timeout

timeout for the Docker build

edit_r

If you want to change the R code to render the HTML, supply R code via a file or string of R as per cr_buildstep_r

r_image

The image that will run the R code from edit_r

allowUnauthenticated

TRUE if can be reached from public HTTP address.

region

The region for cloud run

projectId

The project to build under

Details

Build trigger API is experimental so this function is in development.

This default R code is rendered in the rmd_folder:

lapply(list.files('.', pattern = '.Rmd', full.names = TRUE), rmarkdown::render, output_format = 'html_document')

You need to mirror the GitHub/Bitbucket repo onto Google Cloud Repositories for this to work

See Also

cr_deploy_html that lets you deploy HTML files

Other Deployment functions: cr_deploy_docker(), cr_deploy_github_docker(), cr_deploy_packagetests(), cr_deploy_pkgdown(), cr_deploy_run(), cr_deploy_r()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
cr_project_set("my-project")
cr_region_set("europe-west1")
your_repo <- "MarkEdmondson1234/googleCloudRunner"
cr_deploy_git_html(your_repo, rmd_folder = "vignettes")

# change the Rmd rendering to pkgdown
r <- "devtools::install();pkgdown::build_site()"

cr_deploy_git_html(your_repo,
                   image = paste0(your_repo, "-pkgdown"),
                   rmd_folder = ".",
                   edit_r = r)

# }

Run the code above in your browser using DataLab