From 3440c7fde643914facb422ee04fe1f023e6b5885 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 11:14:27 -0800 Subject: [PATCH 1/9] pkgdown: wrote custom build_site_github_pages --- .github/workflows/pkgdown.yaml | 11 ++++++++--- R/utils.R | 4 +++- _pkgdown.yml | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 6e2d0169..b0ccff8e 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -43,11 +43,16 @@ jobs: DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIDATR_GHACTIONS_DELPHI_EPIDATA_KEY }} run: | if (startsWith("${{ github.event_name }}", "pull_request")) { - mode <- ifelse("${{ github.base_ref }}" == "main", "release", "devel") + mode_ref <- ifelse("${{ github.base_ref }}" == "main", "release", "devel") } else { - mode <- ifelse("${{ github.ref_name }}" == "main", "release", "devel") + mode_ref <- ifelse("${{ github.ref_name }}" == "main", "release", "devel") } - pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode)) + library(pkgdown) + pkg <- as_pkgdown(".", overide = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev", PKGDOWN_DEV_MODE = mode_ref))) + cli::cli_rule("Cleaning files from odl site") + clean_site(pkg) + build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) + build_github_pages(pkg) shell: Rscript {0} - name: Deploy to GitHub pages 🚀 diff --git a/R/utils.R b/R/utils.R index 5f7ab3d3..1216379e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -70,5 +70,7 @@ get_wildcard_equivalent_dates <- function(time_value, time_type = c("day", "week #' inserts each string as a bullet at the end of the "Prepare for release" section #' @keywords internal release_bullets <- function() { - c("merge to main") + c("merge to main", "don't use_version('patch') in the next section", "`use_version('patch')` is redundant because we do this in PRs","`use_dev_version` is also redundant.") } + +pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode_ref)) diff --git a/_pkgdown.yml b/_pkgdown.yml index f923ad58..1d71aea0 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,5 +1,7 @@ # Colors should stay consistent across epipredict & epidatr, using Carnegie # Red https://www.cmu.edu/brand/brand-guidelines/visual-identity/colors.html +development: + mode: devel template: bootstrap: 5 bootswatch: cosmo From bdc2031904fef3059d62a9d8f83f5f719cfbea79 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 11:38:08 -0800 Subject: [PATCH 2/9] parentheses, accidental line --- .github/workflows/pkgdown.yaml | 2 +- R/utils.R | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index b0ccff8e..0506dfad 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -48,7 +48,7 @@ jobs: mode_ref <- ifelse("${{ github.ref_name }}" == "main", "release", "devel") } library(pkgdown) - pkg <- as_pkgdown(".", overide = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev", PKGDOWN_DEV_MODE = mode_ref))) + pkg <- as_pkgdown(".", overide = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) cli::cli_rule("Cleaning files from odl site") clean_site(pkg) build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) diff --git a/R/utils.R b/R/utils.R index 1216379e..93b13b3d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -72,5 +72,3 @@ get_wildcard_equivalent_dates <- function(time_value, time_type = c("day", "week release_bullets <- function() { c("merge to main", "don't use_version('patch') in the next section", "`use_version('patch')` is redundant because we do this in PRs","`use_dev_version` is also redundant.") } - -pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode_ref)) From 5ed99a9f91c8da51a60e0089b2cfecd8a30aa74d Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 11:40:35 -0800 Subject: [PATCH 3/9] overide!=override --- .github/workflows/pkgdown.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 0506dfad..c134973c 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -48,7 +48,7 @@ jobs: mode_ref <- ifelse("${{ github.ref_name }}" == "main", "release", "devel") } library(pkgdown) - pkg <- as_pkgdown(".", overide = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) + pkg <- as_pkgdown(".", override = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) cli::cli_rule("Cleaning files from odl site") clean_site(pkg) build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) From e5b7918d0dd9465c27005a91e9bc540500865fa5 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 19:41:28 +0000 Subject: [PATCH 4/9] style: styler (GHA) --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 93b13b3d..ab868cac 100644 --- a/R/utils.R +++ b/R/utils.R @@ -70,5 +70,5 @@ get_wildcard_equivalent_dates <- function(time_value, time_type = c("day", "week #' inserts each string as a bullet at the end of the "Prepare for release" section #' @keywords internal release_bullets <- function() { - c("merge to main", "don't use_version('patch') in the next section", "`use_version('patch')` is redundant because we do this in PRs","`use_dev_version` is also redundant.") + c("merge to main", "don't use_version('patch') in the next section", "`use_version('patch')` is redundant because we do this in PRs", "`use_dev_version` is also redundant.") } From 3d44b2dde41ebaafa6d05e3db99a73c12d87385a Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 11:48:32 -0800 Subject: [PATCH 5/9] speeling and not overwriting existing function --- .github/workflows/pkgdown.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index c134973c..4576eb58 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -49,7 +49,7 @@ jobs: } library(pkgdown) pkg <- as_pkgdown(".", override = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) - cli::cli_rule("Cleaning files from odl site") + cli::cli_rule("Cleaning files from old site") clean_site(pkg) build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) build_github_pages(pkg) From e51e2a2323790d0fb0300b9523e72a2b691fc6c5 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Fri, 1 Mar 2024 11:57:40 -0800 Subject: [PATCH 6/9] build_github_pages is internal to pkgdown, so import --- .github/workflows/pkgdown.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 4576eb58..b6758373 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -52,7 +52,7 @@ jobs: cli::cli_rule("Cleaning files from old site") clean_site(pkg) build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) - build_github_pages(pkg) + pkgdown:::build_github_pages(pkg) shell: Rscript {0} - name: Deploy to GitHub pages 🚀 From 282eace17fa54ef8fc14962f73692d286cbcce92 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 1 Mar 2024 14:44:28 -0800 Subject: [PATCH 7/9] ci: use a single epidatr key env var --- .github/workflows/pkgdown.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index b6758373..017aaad4 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -23,7 +23,7 @@ jobs: group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }} + DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIDATR_GHACTIONS_DELPHI_EPIDATA_KEY }} steps: - uses: actions/checkout@v3 @@ -39,8 +39,6 @@ jobs: needs: website - name: Build site - env: - DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIDATR_GHACTIONS_DELPHI_EPIDATA_KEY }} run: | if (startsWith("${{ github.event_name }}", "pull_request")) { mode_ref <- ifelse("${{ github.base_ref }}" == "main", "release", "devel") From d6df787d9fd0a12eacc6057693ecd3c24c775257 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 1 Mar 2024 14:46:13 -0800 Subject: [PATCH 8/9] ci: add cli dependency --- .github/workflows/pkgdown.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 017aaad4..5cad4a9a 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -35,7 +35,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::pkgdown, local::. + extra-packages: any::pkgdown, local::., any::cli needs: website - name: Build site @@ -45,11 +45,10 @@ jobs: } else { mode_ref <- ifelse("${{ github.ref_name }}" == "main", "release", "devel") } - library(pkgdown) - pkg <- as_pkgdown(".", override = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) - cli::cli_rule("Cleaning files from old site") - clean_site(pkg) - build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) + pkg <- pkgdown::as_pkgdown(".", override = list(destination = ifelse(mode_ref == "release", "docs", "docs/dev"), PKGDOWN_DEV_MODE = mode_ref)) + cli::cli_rule("Cleaning files from old site...") + pkgdown::clean_site(pkg) + pkgdown::build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE) pkgdown:::build_github_pages(pkg) shell: Rscript {0} From e63a926299367c04be326910d33d3fce8862b272 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 1 Mar 2024 14:51:48 -0800 Subject: [PATCH 9/9] style: styler --- R/utils.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index ab868cac..15356734 100644 --- a/R/utils.R +++ b/R/utils.R @@ -70,5 +70,10 @@ get_wildcard_equivalent_dates <- function(time_value, time_type = c("day", "week #' inserts each string as a bullet at the end of the "Prepare for release" section #' @keywords internal release_bullets <- function() { - c("merge to main", "don't use_version('patch') in the next section", "`use_version('patch')` is redundant because we do this in PRs", "`use_dev_version` is also redundant.") + c( + "merge to main", + "don't use_version('patch') in the next section", + "`use_version('patch')` is redundant because we do this in PRs", + "`use_dev_version` is also redundant." + ) }