Copies the content of a specific filesystem folder to another local Git folder, then stages, commits and pushes the changes. Primarily useful to deploy a static website (typically the output of a static site generator).
Use this function with caution since by default it – except for the paths listed in never_clean
– completely wipes the to_path
directory!
Usage
deploy_static_site(
from_path,
to_path,
clean_to_path = TRUE,
never_clean = paths_to_keep,
branch = NULL,
commit_msg = "auto-deploy static website",
quiet = FALSE
)
Arguments
- from_path
Path to the directory containing the static website files that are to be deployed. A character scalar.
- to_path
Path to the Git (sub)folder to which the static website files are to be deployed. A character scalar.
- clean_to_path
Whether or not to wipe
to_path
before deploying the new website files. Setting this toTRUE
ensures there are no obsolete files left over from previous deployments.- never_clean
A character vector of paths relative to
to_path
which are preserved when wipingto_path
(i.e.clean_to_path = TRUE
). By default, this includes the following files and directories:"netlify.toml"
"robots.txt"
"_headers"
"_redirects"
".gitignore"
".gitmodules"
".gitsigners"
".htaccess"
".hvm"
".well-known"
- branch
The name of the Git branch to which the static website files are to be committed. A character scalar or
NULL
. IfNULL
, defaults to the currently checked out branch of the repositoryto_path
belongs to.- commit_msg
The Git commit message used for the deployment. A character scalar.
- quiet
Whether or not to suppress printing status output from internal processing.
See also
Other Git repository functions:
deploy_pkgdown_site()