forked from USEPA/FrEDI
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (67 loc) · 2.81 KB
/
update_github_pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Instructions for FrEDI website with pkgdown
#
# From FrEDI ‘main’ branch:
# 1) If you haven’t run before:
# Run ‘use_pkgdown_github_pages() – run when the R session working directory is set to the FrEDI R package folder. Only need to run once. This will do a lot of the initial set-up of configuration files and the github action workflows
#
# 2) If you have run before, do the following:
# a) library(pkgdown)
# b) setwd("~/CCD-CSIB/GitHub/Code/FrEDI/FrEDI") (set to FrEDI package location)
# c) Run build_site_github_pages(lazy=TRUE,dest_dir = "../docs/")
# Or
# build_site_github_pages(lazy=TRUE,dest_dir = "../docs/",clean = FALSE)
#
# run this from inside the FrEDI R package folder on ‘main’ or and new branch. This will write to the ./docs folder in the root directory of main, all the information needed to build the site. Then set Github pages to look in that directory (only needs to be done once when setting up the IO page).
#
# (Update the vignettes/articles/Example scripts as needed)
#
# 3) After code is run, commit changes to main and push to github so that the site changes can become live.
#
# This process requires the user to manually re-build the site following step 2 every time there are updates to the code that we want reflected on the IO site.
name: 5. Update GitHub Pages
on:
workflow_dispatch:
jobs:
update_github_pages:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
name: Load Package Code
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: true
cache-version: 1
packages: |
any::tidyverse
any::ggpubr
any::openxlsx
any::devtools
any::zoo
any::pkgdown
any::kableExtra
- name: Build documentation
run: |
Rscript -e '
###### Paths ######
### Main repo path, FrEDI project path, scripts path
require(pkgdown)
rPath0 <- ".";
docPath0 <- rPath0 |> file.path("docs")
# pkgdown::build_site_github_pages(lazy=TRUE, dest_dir=docPath0, clean=FALSE, new_process=FALSE)
pkgdown::build_site_github_pages(lazy=TRUE, clean=TRUE, new_process=TRUE)
'
- name: Commit results
run: |
git config --local core.autocrlf false
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add ./docs/*
git pull origin ${{ github.head_ref }} --autostash --rebase -X ours
git commit -am "Updated GitHub pages"
git push