5
5
# update the documentation web site on pushes to `dev` branch.
6
6
on :
7
7
push :
8
- branches : [main]
8
+ branches : [main, dev ]
9
9
pull_request :
10
- branches : [main]
10
+ branches : [main, dev ]
11
11
release :
12
12
types : [published]
13
13
workflow_dispatch :
23
23
group : pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
24
24
env :
25
25
GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
26
- DELPHI_EPIDATA_KEY : ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
26
+ DELPHI_EPIDATA_KEY : ${{ secrets.SECRET_EPIDATR_GHACTIONS_DELPHI_EPIDATA_KEY }}
27
27
steps :
28
28
- uses : actions/checkout@v3
29
29
@@ -35,13 +35,29 @@ jobs:
35
35
36
36
- uses : r-lib/actions/setup-r-dependencies@v2
37
37
with :
38
- extra-packages : any::pkgdown, local::.
38
+ extra-packages : any::pkgdown, local::., any::cli
39
39
needs : website
40
40
41
41
- name : Build site
42
- env :
43
- DELPHI_EPIDATA_KEY : ${{ secrets.SECRET_EPIDATR_GHACTIONS_DELPHI_EPIDATA_KEY }}
44
- run : pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
42
+ run : |
43
+ override <- if (startsWith("${{ github.event_name }}", "pull_request")) {
44
+ if ("${{ github.base_ref }}" == "main") {
45
+ list(development = list(mode = "release", version_label = "light"))
46
+ } else {
47
+ list(development = list(mode = "devel", version_label = "success"))
48
+ }
49
+ } else {
50
+ if ("${{ github.ref_name }}" == "main") {
51
+ list(development = list(mode = "release", version_label = "light"))
52
+ } else {
53
+ list(development = list(mode = "devel", version_label = "success"))
54
+ }
55
+ }
56
+ pkg <- pkgdown::as_pkgdown(".", override = override)
57
+ cli::cli_rule("Cleaning files from old site...")
58
+ pkgdown::clean_site(pkg)
59
+ pkgdown::build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE)
60
+ pkgdown:::build_github_pages(pkg)
45
61
shell : Rscript {0}
46
62
47
63
- name : Deploy to GitHub pages 🚀
0 commit comments