File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments