Skip to content

Commit 8929a73

Browse files
committed
Recreate file
1 parent 063c72c commit 8929a73

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

R/rog_actions_pkgdown_branch.R

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#' Creates a GitHub action that deploys on `gh-pages` branch
2+
#'
3+
#' The GitHub action created would build a `pkgdown` of
4+
#' your package in the `gh-pages` branch of your repo.
5+
#'
6+
#' @seealso [rog_build()]
7+
#' @export
8+
#'
9+
#' @param pkg Path to package.
10+
#' @param overwrite Overwrite the action if it was already present.
11+
rog_actions_pkgdown_branch <- function(pkg = ".", overwrite = TRUE) {
12+
# Check destdir
13+
14+
destdir <- file.path(pkg, ".github", "workflows")
15+
checkdir <- dir.exists(destdir)
16+
if (isFALSE(checkdir)) {
17+
dir.create(destdir, recursive = TRUE)
18+
}
19+
20+
usethis::use_build_ignore(".github")
21+
usethis::use_build_ignore("._pkgdown.yml")
22+
23+
# Check gitignore
24+
usethis::use_git_ignore("*.html", directory = ".github")
25+
usethis::use_git_ignore("R-version", directory = ".github")
26+
usethis::use_git_ignore("*.Rds", directory = ".github")
27+
28+
# Get action file
29+
filepath <- system.file("yaml/rogtemplate-gh-pages.yaml", package = "rogtemplate")
30+
31+
# Copy
32+
result <- file.copy(filepath, destdir, overwrite = overwrite)
33+
if (result) {
34+
message("Success!")
35+
} else {
36+
message("File not updated")
37+
}
38+
39+
invisible()
40+
}

0 commit comments

Comments
 (0)