step_do_push_deploy: Step: Perform push deploy

View source: R/steps-git.R

step_do_push_deployR Documentation

Step: Perform push deploy

Description

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

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

Usage

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

Other deploy steps: step_push_deploy(), step_setup_push_deploy()

Other steps: step_add_to_drat(), step_add_to_known_hosts(), step_build_pkgdown(), step_hello_world(), step_install_pkg, step_install_ssh_keys(), step_push_deploy(), step_run_code(), step_session_info(), step_setup_push_deploy(), step_setup_ssh(), step_test_ssh(), step_write_text_file()

Examples

## Not run: 
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()

## End(Not run)

ropensci/tic documentation built on Jan. 18, 2024, 3:57 a.m.