55# update the documentation web site on pushes to `dev` branch.
66on :
77 push :
8- branches : [main]
8+ branches : [main, dev ]
99 pull_request :
10- branches : [main]
10+ branches : [main, dev ]
1111 release :
1212 types : [published]
1313 workflow_dispatch :
2323 group : pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2424 env :
2525 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 }}
2727 steps :
2828 - uses : actions/checkout@v3
2929
@@ -35,13 +35,29 @@ jobs:
3535
3636 - uses : r-lib/actions/setup-r-dependencies@v2
3737 with :
38- extra-packages : any::pkgdown, local::.
38+ extra-packages : any::pkgdown, local::., any::cli
3939 needs : website
4040
4141 - 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)
4561 shell : Rscript {0}
4662
4763 - name : Deploy to GitHub pages 🚀
0 commit comments