Commits and pushes to a repo prepared by step_setup_push_deploy().

Deployment usually requires setting up SSH keys with use_tic().

step_do_push_deploy(
  path = ".",
  commit_message = NULL,
  commit_paths = ".",
  force = FALSE
)

Arguments

path

[string]
Path to the repository, default "." which means setting up the current repository.

commit_message

[string]
Commit message to use, defaults to a useful message linking to the CI build and avoiding recursive CI runs.

commit_paths

[character]
Restrict the set of directories and/or files added to Git before deploying. Default: deploy all files.

force

[logical]
Add --force flag to git commands?

Details

It is highly recommended to restrict the set of files touched by the deployment with the commit_paths argument: this step assumes that it can freely overwrite all changes to all files below commit_paths, and will not warn in case of conflicts.

To mitigate conflicts race conditions to the greatest extent possible, the following strategy is used:

  • The changes are committed to the branch

  • Before pushing, new commits are fetched, and the changes are cherry-picked on top of the new commits

If no new commits were pushed after the CI run has started, this strategy is equivalent to committing and pushing. In the opposite case, if the remote repo has new commits, the deployment is safely applied to the current tip.

See also

Examples

if (FALSE) { dsl_init() # Deployment only works if a companion step_setup_push_deploy() is added get_stage("deploy") %>% add_step(step_setup_push_deploy(path = "docs", branch = "gh-pages")) %>% add_step(step_build_pkgdown()) if (rlang::is_installed("git2r") && git2r::in_repository()) { get_stage("deploy") %>% add_step(step_do_push_deploy(path = "docs")) } dsl_get() }