Skip to content

Commit 9143422

Browse files
committed
doc: add comments explaining pkgdown action
* also simplify the target_ref calculation
1 parent a48d82c commit 9143422

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/pkgdown.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,21 @@ jobs:
4242
needs: website
4343

4444
- name: Build site
45+
# - target_ref gets the ref from a different variable, depending on the event
46+
# - override allows us to set the pkgdown mode and version_label
47+
# - mode: release is the standard build mode, devel places the site in /dev
48+
# - version_label: 'light' and 'success' are CSS labels for Bootswatch: Cosmo
49+
# https://bootswatch.com/cosmo/
50+
# - we use pkgdown:::build_github_pages to build the site because of an issue in pkgdown
51+
# https://github.com/r-lib/pkgdown/issues/2257
4552
run: |
46-
target_ref <- if (startsWith("${{ github.event_name }}", "pull_request")) {
47-
"${{ github.base_ref }}"
48-
} else {
49-
"${{ github.ref }}"
50-
}
53+
target_ref <- ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}
5154
override <- if (target_ref == "main") {
5255
list(development = list(mode = "release", version_label = "light"))
53-
} else {
56+
} else if (target_ref == "dev") {
5457
list(development = list(mode = "devel", version_label = "success"))
58+
} else {
59+
stop("Unexpected target_ref: ", target_ref)
5560
}
5661
pkg <- pkgdown::as_pkgdown(".", override = override)
5762
cli::cli_rule("Cleaning files from old site...")

0 commit comments

Comments
 (0)