wflow_publish
is the main workflowr function. Use it when you are
ready to publish an analysis to your site. wflow_publish
performs
three steps: 1) commit the file(s), 2) rebuild the R Markdown file(s), 3)
commit the generated website file(s). These steps ensure that the version of
the HTML file is created by the latest version of the R Markdown file, which
is critical for reproducibility.
wflow_publish(files = NULL, message = NULL, all = FALSE, force = FALSE, update = FALSE, republish = FALSE, view = interactive(), seed = 12345, dry_run = FALSE, project = ".")
files | character (default: NULL). Files to be added and committed with Git (step 1). Any R Markdown files will also be built (step 2) and their output HTML and figures will be subsequently committed (step 3). Supports file globbing. |
---|---|
message | character (default: NULL). A commit message. |
all | logical (default: FALSE). Automatically stage files that have been
modified and deleted. Equivalent to: |
force | logical (default: FALSE). Allow adding otherwise ignored files.
Equivalent to: |
update | logical (default: FALSE). Build any files that have been committed more recently than their corresponding HTML files (and do not have any unstaged or staged changes). This ensures that the commit version ID inserted into the HTML corresponds to the exact version of the source file that was used to produce it. |
republish | logical (default: FALSE). Build all published R Markdown
files. Useful for site-wide changes like updating the theme, navigation
bar, or any other setting in |
view | logical (default: |
seed | numeric (default: 12345). The seed to set before building each
file. Passed to |
dry_run | logical (default: FALSE). Preview the proposed action but do not actually add or commit any files. |
project | character (default: ".") By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory. |
Returns an object of class wflow_publish
, which is a list with
the following elements:
step1: An object of class wflow_commit
from the first
step of committing the analysis files.
step2: An object of class wflow_build
from the second
step of building the HTML files.
step3: An object of class wflow_commit
from the third
step of committing the HTML files.
not_run({ # single file wflow_publish("analysis/file.Rmd", "Informative commit message") # All tracked files that have been edited wflow_publish(all = TRUE, message = "Informative commit message") # A new file plus all tracked files that have been edited wflow_publish("analysis/file.Rmd", "Informative commit message", all = TRUE) # Multiple files wflow_publish(c("analysis/file.Rmd", "analysis/another.Rmd"), "Informative commit message") # All R Markdown files that start with the pattern "new_" wflow_publish("analysis/new_*Rmd", "Informative commit message") # Republish all published files regardless of whether they have been # modified. Useful for changing some universal aspect of the site, # e.g. the theme specifid in _site.yml. wflow_publish("analysis/_site.yml", "Informative commit message", republish = TRUE) })