From 4680c6f61adf5c71029898b257b1afa10d94f10c Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 8 Mar 2024 09:32:21 +0100 Subject: [PATCH] ci: updating CI to build book --- .github/workflows/deploy_bookdown.yml | 22 ++++++++------ redirect.R | 42 ++++----------------------- 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/.github/workflows/deploy_bookdown.yml b/.github/workflows/deploy_bookdown.yml index 42be002d..63ccbcfa 100644 --- a/.github/workflows/deploy_bookdown.yml +++ b/.github/workflows/deploy_bookdown.yml @@ -13,15 +13,10 @@ jobs: name: Render-Book - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 - - - uses: r-lib/actions/setup-r@v2 - with: - crayon.enabled: 'FALSE' - r-version: '4.2.3' + - uses: actions/checkout@v4 - uses: actions/cache@v1 with: @@ -30,8 +25,17 @@ jobs: restore-keys: | ${{ runner.os }}-renv- + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + crayon.enabled: 'FALSE' + r-version: '4.1.0' + Ncpus: 4 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-renv@v2 + - name: Install tinytex uses: r-lib/actions/setup-tinytex@v2 @@ -49,8 +53,8 @@ jobs: - name: Spell check run: Rscript before-build-spellcheck.R env: - EMAIL: ${{ secrets.EMAIL }} # must be a verified email - GH_TOKEN: ${{ secrets.TOKEN }} # https://github.com/settings/tokens + EMAIL: ${{ secrets.EMAIL }} + GH_TOKEN: ${{ secrets.TOKEN }} - name: Before build run: Rscript prep.R diff --git a/redirect.R b/redirect.R index 41f873d9..993b402d 100644 --- a/redirect.R +++ b/redirect.R @@ -5,7 +5,7 @@ redirects <- yaml::read_yaml("_output.yml")$redirects make_redirect <- function(from, to){ html <- sprintf( - '', + '', to ) dest <- fs::path("_site", from, ext = "html") @@ -15,55 +15,25 @@ make_redirect <- function(from, to){ mapply(make_redirect, from = names(redirects), to = redirects) -# make_redirect_apps <- function(name, url){ -# fs::dir_create( -# fs::path( -# "redirects", -# name -# ) -# ) -# fls <- fs::path( -# "_site", -# name, -# "index.html" -# ) -# fs::file_create( -# fls -# ) -# write(file = fls, -# sprintf('', url) -# ) -# } - -# make_redirect_apps("tidytuesday201942", "https://connect.thinkr.fr/tidytuesday201942/") -# make_redirect_apps("hexmake", "https://connect.thinkr.fr/hexmake/") -# make_redirect_apps("minifying", "https://connect.thinkr.fr/minifying/") -# make_redirect_apps("golemhtmltemplate", "https://connect.thinkr.fr/golemhtmltemplate/") -# make_redirect_apps("shinipsumdemo", "https://connect.thinkr.fr/shinipsumdemo/") -# make_redirect_apps("databasedemo", "https://connect.thinkr.fr/databasedemo/") -# make_redirect_apps("graysacle", "https://connect.thinkr.fr/graysacle/") -# make_redirect_apps("bs4dashdemo", "https://connect.thinkr.fr/bs4dashdemo/") -# make_redirect_apps("shinyfuture", "https://connect.thinkr.fr/shinyfuture/") - # Creating the redirect unlink("redirects", TRUE, TRUE) make_redirect <- function(name, url){ fs::dir_create( fs::path( - "redirects", + "redirects", name ) ) fls <- fs::path( - "redirects", - name, + "redirects", + name, "index.html" ) fs::file_create( fls ) - write(file = fls, + write(file = fls, sprintf('', url) ) } @@ -88,7 +58,7 @@ try({ dirs )){ fs::dir_copy( - i, + i, fs::path("_site", basename(i)) ) }