From 3d006fd1305f28f913ee238e0ebb7bb053dfe488 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 10:06:44 -0500 Subject: [PATCH 01/12] Create connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/connect-deploy.yaml diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml new file mode 100644 index 0000000000..103591a387 --- /dev/null +++ b/.github/workflows/connect-deploy.yaml @@ -0,0 +1,71 @@ +on: + push: + branches: + - master + pull_request: + branches: + - master + +name: quarto-connect-gt-examples-site + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + with: + version: pre-release + + - name: Print Quarto version + run: | + quarto --version + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.2' + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + gt + shiny + tidyverse + dplyr + tidyr + ggplot2 + lubridate + paletteer + janitor + any::sessioninfo + dependencies: '"hard"' + + - name: Install package + run: R CMD INSTALL . + + - name: Generate Quarto files for website + run: | + Rscript -e 'gt:::write_gt_examples_qmd_files()' + + - name: Build Quarto site + run: | + quarto render gt_qmd_examples + + - name: Create manifest.json + shell: Rscript {0} + run: | + rsconnect::writeManifest() + + - name: Publish Connect content + uses: rstudio/actions/connect-publish@main + with: + url: ${{ secrets.CONNECT_SERVER }} + api-key: ${{ secrets.CONNECT_API_KEY }} + access-type: all + show-logs: true + dir: ./gt-examples/:/gt_qmd_examples/_site From 294b0248b9959516561ac0adc5bf0f9c0177bbb8 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 10:24:30 -0500 Subject: [PATCH 02/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 103591a387..94ffecbd19 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -42,6 +42,7 @@ jobs: lubridate paletteer janitor + rsconnect any::sessioninfo dependencies: '"hard"' From 7479dc4d77cc7f4f10e1754815533dd8a5542f29 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 15:14:00 -0500 Subject: [PATCH 03/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 94ffecbd19..2fe5861a01 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -49,7 +49,7 @@ jobs: - name: Install package run: R CMD INSTALL . - - name: Generate Quarto files for website + - name: Generate Quarto files for the website run: | Rscript -e 'gt:::write_gt_examples_qmd_files()' From 04f1d53ec7cb620fdc93408e57f5bc41c76e603e Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 15:37:19 -0500 Subject: [PATCH 04/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 2fe5861a01..746bc425cd 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -49,7 +49,7 @@ jobs: - name: Install package run: R CMD INSTALL . - - name: Generate Quarto files for the website + - name: Generate Quarto files for website run: | Rscript -e 'gt:::write_gt_examples_qmd_files()' @@ -57,16 +57,11 @@ jobs: run: | quarto render gt_qmd_examples - - name: Create manifest.json - shell: Rscript {0} - run: | - rsconnect::writeManifest() - - - name: Publish Connect content - uses: rstudio/actions/connect-publish@main + - name: Publish to Connect + uses: quarto-dev/quarto-actions/publish@v2 with: - url: ${{ secrets.CONNECT_SERVER }} - api-key: ${{ secrets.CONNECT_API_KEY }} - access-type: all - show-logs: true - dir: ./gt-examples/:/gt_qmd_examples/_site + target: connect + render: false + path: gt_qmd_examples + CONNECT_SERVER: ${{ secrets.CONNECT_SERVER }} + CONNECT_API_KEY: ${{ secrets.CONNECT_API_KEY }} From acef55425a902135c341e2d4b7bd3c918fd8287a Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 16:42:49 -0500 Subject: [PATCH 05/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 746bc425cd..4068072105 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -49,7 +49,7 @@ jobs: - name: Install package run: R CMD INSTALL . - - name: Generate Quarto files for website + - name: Generate Quarto files for the website run: | Rscript -e 'gt:::write_gt_examples_qmd_files()' @@ -57,11 +57,16 @@ jobs: run: | quarto render gt_qmd_examples - - name: Publish to Connect - uses: quarto-dev/quarto-actions/publish@v2 + - name: Create manifest.json + shell: Rscript {0} + run: | + rsconnect::writeManifest() + + - name: Publish Connect content + uses: rstudio/actions/connect-publish@main with: - target: connect - render: false - path: gt_qmd_examples - CONNECT_SERVER: ${{ secrets.CONNECT_SERVER }} - CONNECT_API_KEY: ${{ secrets.CONNECT_API_KEY }} + url: ${{ secrets.CONNECT_SERVER }} + api-key: ${{ secrets.CONNECT_API_KEY }} + access-type: all + show-logs: true + dir: .:/gt_qmd_examples/_site From fc80c05c56c8b4be8fb6edb800efa49b285071d5 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 17:42:04 -0500 Subject: [PATCH 06/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 4068072105..bca5df191d 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -69,4 +69,4 @@ jobs: api-key: ${{ secrets.CONNECT_API_KEY }} access-type: all show-logs: true - dir: .:/gt_qmd_examples/_site + dir: ./gt_qmd_examples:/gt_qmd_examples From e4fafd4555957da91f88adfc910d7335462f552d Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 19 Jan 2024 18:00:57 -0500 Subject: [PATCH 07/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index bca5df191d..95edf1d99c 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -69,4 +69,4 @@ jobs: api-key: ${{ secrets.CONNECT_API_KEY }} access-type: all show-logs: true - dir: ./gt_qmd_examples:/gt_qmd_examples + dir: ./gt_qmd_examples/_site:/gt_qmd_examples From a2890134cad585f4f8e7d75f39f2a5ff0ebeb55a Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 25 Jan 2024 17:28:30 -0500 Subject: [PATCH 08/12] Update utils_examples.R --- R/utils_examples.R | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/R/utils_examples.R b/R/utils_examples.R index cb557524b2..8989369d0c 100644 --- a/R/utils_examples.R +++ b/R/utils_examples.R @@ -266,13 +266,13 @@ write_gt_examples_qmd_files <- function( index_tbl <- dplyr::bind_rows(index_tbl, index_tbl_i) } - index_tbl <- + index_tbl_gt <- index_tbl %>% dplyr::arrange(family, number) %>% dplyr::mutate( name = dplyr::case_when( type == "function" ~ paste0( - "[`", name, "()`](gt-", name , ".qmd)" + "[", name, "()](gt-", name , ".qmd)" ), .default = name ) @@ -299,17 +299,31 @@ write_gt_examples_qmd_files <- function( ) %>% gt(groupname_col = "group", process_md = TRUE) %>% fmt_markdown() %>% + fmt_url(columns = name, color = "#045AA2") %>% cols_hide(columns = c(type, family, number)) %>% + tab_style( + style = cell_text( + font = system_fonts("monospace-code"), + weight = 500 + ), + locations = cells_body(columns = name) + ) %>% tab_options(column_labels.hidden = TRUE) writeLines( text = c( "---", "format: html", + "html-table-processing: none", "---", "", + paste("The **gt** package has", nrow(index_tbl), "functions."), + "Each of these functions has documentation filled with examples.", + "The table below organizes all of the functions into families and ", + "links to separate pages of **gt** table examples by function.", + "", "```{=html}", - as_raw_html(index_tbl), + as_raw_html(index_tbl_gt), "```", "" ), @@ -320,14 +334,16 @@ write_gt_examples_qmd_files <- function( text = c( "project:", " type: website", + "", "render:", " - \"*.qmd\"", "", "website:", " title: \"The gt package\"", - "navbar:", - " left:", - " - href: index.qmd", + " navbar:", + " left:", + " - text: \"home\"", + " file: index.qmd", "", "format:", " html:", @@ -344,6 +360,7 @@ write_gt_examples_qmd_files <- function( text = c( "---", "format: html", + "html-table-processing: none", "toc: false", "---", "", From 9bebebd70e994d5dba015fcde88be3c5ca6e09d5 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 25 Jan 2024 17:29:14 -0500 Subject: [PATCH 09/12] Update connect-deploy.yaml --- .github/workflows/connect-deploy.yaml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/connect-deploy.yaml b/.github/workflows/connect-deploy.yaml index 95edf1d99c..8c063d5111 100644 --- a/.github/workflows/connect-deploy.yaml +++ b/.github/workflows/connect-deploy.yaml @@ -57,16 +57,11 @@ jobs: run: | quarto render gt_qmd_examples - - name: Create manifest.json - shell: Rscript {0} - run: | - rsconnect::writeManifest() - - - name: Publish Connect content - uses: rstudio/actions/connect-publish@main + - name: Publish to Connect + uses: quarto-dev/quarto-actions/publish@v2 with: - url: ${{ secrets.CONNECT_SERVER }} - api-key: ${{ secrets.CONNECT_API_KEY }} - access-type: all - show-logs: true - dir: ./gt_qmd_examples/_site:/gt_qmd_examples + target: connect + path: gt_qmd_examples + render: false + CONNECT_SERVER: ${{ secrets.CONNECT_SERVER }} + CONNECT_API_KEY: ${{ secrets.CONNECT_API_KEY }} From 62dd5d701232813a3ca7ffaa71fd23bd44088bad Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 25 Jan 2024 18:04:30 -0500 Subject: [PATCH 10/12] Update utils_examples.R --- R/utils_examples.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils_examples.R b/R/utils_examples.R index 8989369d0c..f6d2e76440 100644 --- a/R/utils_examples.R +++ b/R/utils_examples.R @@ -299,7 +299,7 @@ write_gt_examples_qmd_files <- function( ) %>% gt(groupname_col = "group", process_md = TRUE) %>% fmt_markdown() %>% - fmt_url(columns = name, color = "#045AA2") %>% + fmt_url(columns = name, color = "#045AA2", target = "_self") %>% cols_hide(columns = c(type, family, number)) %>% tab_style( style = cell_text( From f1fca7860d6bc3c63a4b45bf36a153b0f17f7316 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 25 Jan 2024 18:04:37 -0500 Subject: [PATCH 11/12] Update utils_examples.R --- R/utils_examples.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/R/utils_examples.R b/R/utils_examples.R index f6d2e76440..5680ac5550 100644 --- a/R/utils_examples.R +++ b/R/utils_examples.R @@ -375,6 +375,16 @@ write_gt_examples_qmd_files <- function( con = paste0(output_dir, "/gt-", topic, ".qmd") ) } + + writeLines( + text = c( + "- source: project", + " connect:", + " - id: b5709bdb-5712-42db-b265-2bfa02b5ffb6", + " - url: https://colorado.posit.co/rsc/content/b5709bdb-5712-42db-b265-2bfa02b5ffb6/" + ), + con = paste0(output_dir, "/_publish.yml") + ) } #nocov end From 10989330bb7c88a62a4e070c5e62c486cd374fd3 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 26 Jan 2024 14:05:30 -0500 Subject: [PATCH 12/12] Update utils_examples.R --- R/utils_examples.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utils_examples.R b/R/utils_examples.R index 5680ac5550..eda512e2ee 100644 --- a/R/utils_examples.R +++ b/R/utils_examples.R @@ -380,8 +380,8 @@ write_gt_examples_qmd_files <- function( text = c( "- source: project", " connect:", - " - id: b5709bdb-5712-42db-b265-2bfa02b5ffb6", - " - url: https://colorado.posit.co/rsc/content/b5709bdb-5712-42db-b265-2bfa02b5ffb6/" + " - id: b5709bdb-5712-42db-b265-2bfa02b5ffb6"#, + #" - url: https://colorado.posit.co/rsc/content/b5709bdb-5712-42db-b265-2bfa02b5ffb6/" ), con = paste0(output_dir, "/_publish.yml") )