@@ -9,46 +9,47 @@ name: pkgdown
9
9
10
10
jobs :
11
11
pkgdown :
12
+ if : github.event_name == 'push' || github.event.pull_request.head.repo.fork == false
12
13
runs-on : ubuntu-latest
13
14
env :
14
15
GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
16
+ NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
17
+ NETLIFY_SITE_ID : ${{ secrets.NETLIFY_SITE_ID }}
18
+ isPush : ${{ github.event_name == 'push' }}
19
+
15
20
steps :
16
21
- uses : actions/checkout@v2
17
22
23
+ - uses : r-lib/actions/setup-tinytex@v2
24
+
18
25
- uses : r-lib/actions/setup-pandoc@v2
19
26
20
27
- uses : r-lib/actions/setup-r@v2
28
+ with :
29
+ use-public-rspm : true
21
30
22
31
- uses : r-lib/actions/setup-r-dependencies@v2
23
32
with :
24
- extra-packages : pkgdown
33
+ extra-packages : any:: pkgdown, local::.
25
34
needs : website
26
-
27
- - name : Query dependencies
28
- run : |
29
- install.packages('remotes')
30
- saveRDS(remotes::dev_package_deps(dependencies=TRUE), ".github/depends.Rds", version = 2)
31
- writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
32
- shell : Rscript {0}
33
-
34
- - name : Cache R packages
35
- uses : actions/cache@v2
36
- with :
37
- path : ${{ env.R_LIBS_USER }}
38
- key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
39
- restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
40
-
41
- - name : Install dependencies
42
- run : |
43
- remotes::install_deps(dependencies=TRUE)
44
- install.packages("pkgdown", type = "source")
45
- shell : Rscript {0}
46
35
47
36
- name : Install package
48
37
run : R CMD INSTALL .
49
38
50
- - name : Deploy package
39
+ - name : Build and deploy pkgdown site
40
+ if : contains(env.isPush, 'true')
51
41
run : |
52
42
git config --local user.name "$GITHUB_ACTOR"
53
43
git config --local user.email "[email protected] "
54
44
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
45
+ - name : Create website
46
+ if : contains(env.isPush, 'false')
47
+ run : |
48
+ pkgdown::build_site()
49
+ shell : Rscript {0}
50
+
51
+ - name : Create index file
52
+ if : contains(env.isPush, 'false')
53
+ run : |
54
+ echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;URL=/dev/index.html" /> <script language="javascript"> window.location.replace('/dev/index.html')</script></head></html>' > ./docs/index.html
55
+
0 commit comments