Skip to content

Commit

Permalink
ci: updating CI to build book
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFay committed Mar 8, 2024
1 parent b9c38d4 commit 4680c6f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 45 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/deploy_bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand Down
42 changes: 6 additions & 36 deletions redirect.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ redirects <- yaml::read_yaml("_output.yml")$redirects

make_redirect <- function(from, to){
html <- sprintf(
'<head><meta http-equiv="refresh" content="0; URL=%s.html" /></head>',
'<head><meta http-equiv="refresh" content="0; URL=%s.html" /></head>',
to
)
dest <- fs::path("_site", from, ext = "html")
Expand All @@ -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('<head><meta http-equiv="refresh" content="0; URL=%s" /></head>', 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('<head><meta http-equiv="refresh" content="0; URL=%s" /></head>', url)
)
}
Expand All @@ -88,7 +58,7 @@ try({
dirs
)){
fs::dir_copy(
i,
i,
fs::path("_site", basename(i))
)
}
Expand Down

0 comments on commit 4680c6f

Please sign in to comment.