Create an (action) step to deploy static assets

ghpages(
  src = "$DEPLOY_PATH",
  name = "Deploy to GitHub Pages",
  `if` = "github.ref == 'refs/heads/master'",
  ...
)

rsync(
  src = "$DEPLOY_PATH",
  name = "Deploy via RSync",
  `if` = "github.ref == 'refs/heads/master'",
  HOST_NAME,
  HOST_IP,
  HOST_FINGERPRINT,
  user,
  dest,
  env = NULL,
  with = NULL,
  ...
)

netlify(
  src = "$DEPLOY_PATH",
  name = "Deploy to Netlify",
  `if` = "github.ref == 'refs/heads/master'",
  prod = TRUE,
  with = NULL,
  env = NULL,
  site,
  ...
)

firebase(
  name = "Deploy to Firebase",
  `if` = "github.ref == 'refs/heads/master'",
  PROJECT_ID = NULL,
  with = NULL,
  env = NULL,
  ...
)

Arguments

src

[character(1)] giving the path relative from your /github/workspace to the directory to be published without trailing slash. Defaults to "$DEPLOY_PATH", an environment variable containing the path set by website().

name

[character(1)] giving addtional options for the step. Multiline strings are not supported. Defaults to a name for the deploy step.

if

[character(1)] giving additional options for the step. Multiline strings are not supported. Defaults to "github.ref == 'refs/heads/master'" to only deploy from branch master.

...

Arguments passed on to step

id

[character(1)] giving additional options for the step. Multiline strings are not supported. Defaults to NULL.

working-directory

[character(1)] giving the default working directory. Defaults to NULL.

continue-on-error

[logical(1)] giving whether to allow a job to pass when this step fails. Defaults to NULL.

timeout-minutes

[integer(1)] giving the maximum number of minutes to run the step before killing the process. Defaults to NULL.

HOST_NAME

[character(1)] giving the name of the server you wish to deploy to, such as foo.example.com.

HOST_IP

[character(1)] giving the IP of the server you wish to deploy to, such as 111.111.11.111.

HOST_FINGERPRINT

[character(1)] giving the fingerprint of the server you wish to deploy to, can have different formats.

user

[character(1)] giving the user at the target HOST_NAME.

dest

[character(1)] giving the directory from the root of the HOST_NAME target to write to.

env

[list()] giving a named list of additional parameters. Defaults to NULL.

with

[list()] giving a named list of additional parameters. Defaults to NULL.

prod

[logical(1)] giving whether the deploy should be to production.

site

[character(1)] giving a site ID to deploy to.

PROJECT_ID

[character(1)] giving a specific project to use for all commands, not required if you specify a project in your `.firebaserc`` file.

Functions

GitHub Pages

Remember to provide a GitHub personal access token secret named GH_PAT to the GitHub UI.

  1. Set up a new PAT. You can use usethis::browse_github_pat() to get to the right page. Remember that this PAT is not for your local machine, but for GitHub actions.

  2. Copy the PAT to your clipboard.

  3. Go to the settings of your repository, and paste the PAT as a secret. The secret must be called GH_PAT.

RSync

Remember to provide SSH_PRIVATE_KEY and SSH_PUBLIC_KEY as secrets to the GitHub UI..

Netlify

Remember to provide NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID (optional) as secrets to the GitHub UI.

Google Firebase

Remember to provide FIREBASE_TOKEN as a secret to the GitHub UI.

Configuration details other than PROJECT_ID are read from the firebase.json at the root of your repository.

Because firebase gets the deploy directory from a firebase.json file, it cannot use $DEPLOY_DIR. Manually edit your firebase.json to provide the deploy path.

See also

Other steps: checkout(), install_deps(), pkg_dev, rscript()