This lets you set up triggers that will update an R generated website each commit.

cr_deploy_run_website(
  repo,
  image = paste0("website-", format(Sys.Date(), "%Y%m%d")),
  rmd_folder = NULL,
  html_folder = NULL,
  image_tag = "$SHORT_SHA",
  timeout = 600L,
  edit_r = NULL,
  r_image = "gcr.io/gcer-public/packagetools:latest",
  allowUnauthenticated = TRUE,
  region = cr_region_get(),
  projectId = cr_project_get()
)

Arguments

repo

A git repository defined in cr_buildtrigger_repo

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

image_tag

What to tag the build docker image

timeout

Timeout for the 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. If FALSE will configure a service-email called (name)-cloudrun-invoker@(project-id).iam.gserviceaccount.com

region

The region for cloud run

projectId

The project to build under

Details

This lets you render the Rmd (or other R functions that produce HTML) in a folder for your repo, which will then be hosted on a Cloud Run enabled with nginx. Each time you push to git with modified Rmd code, it will build the new HTML and push an update to the website.

This default R code is rendered in the rmd_folder:

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

See also

cr_deploy_html that lets you deploy just HTML files and cr_deploy_pkgdown for running pkgdown websites.

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

Examples

if (FALSE) { cr_project_set("my-project") cr_region_set("europe-west1") your_repo <- cr_buildtrigger_repo("MarkEdmondson1234/googleCloudRunner") cr_deploy_run_website(your_repo, rmd_folder = "vignettes") # change the Rmd rendering to pkgdown r <- "devtools::install();pkgdown::build_site()" cr_deploy_run_website(your_repo, image = paste0(your_repo, "-pkgdown"), rmd_folder = ".", edit_r = r) }