Skip to content

Commit 38fb5fd

Browse files
authored
Merge pull request #264 from cmu-delphi/ds/ci2
ci: fix pkgdown and improve colors
2 parents e4ca291 + c8fa293 commit 38fb5fd

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/pkgdown.yaml

+12-4
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,20 @@ jobs:
4040

4141
- name: Build site
4242
run: |
43-
if (startsWith("${{ github.event_name }}", "pull_request")) {
44-
mode_ref <- ifelse("${{ github.base_ref }}" == "main", "release", "devel")
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+
}
4549
} else {
46-
mode_ref <- ifelse("${{ github.ref_name }}" == "main", "release", "devel")
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+
}
4755
}
48-
pkg <- pkgdown::as_pkgdown(".", override = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref))
56+
pkg <- pkgdown::as_pkgdown(".", override = override)
4957
cli::cli_rule("Cleaning files from old site...")
5058
pkgdown::clean_site(pkg)
5159
pkgdown::build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE)

_pkgdown.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Colors should stay consistent across epipredict & epidatr, using Carnegie
22
# Red https://www.cmu.edu/brand/brand-guidelines/visual-identity/colors.html
3+
4+
# This is to give a default value to the `mode` parameter in the
5+
# `pkgdown::build_site` function. This is useful when building the site locally,
6+
# as it will default to `devel` mode. In practice, this should all be handled
7+
# dynamically by the CI/CD pipeline.
38
development:
49
mode: devel
10+
version_label: success
11+
512
template:
613
bootstrap: 5
714
bootswatch: cosmo

0 commit comments

Comments
 (0)