Skip to content

Commit 4680c6f

Browse files
committed
ci: updating CI to build book
1 parent b9c38d4 commit 4680c6f

File tree

2 files changed

+19
-45
lines changed

2 files changed

+19
-45
lines changed

.github/workflows/deploy_bookdown.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@ jobs:
1313

1414
name: Render-Book
1515

16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-20.04
1717

1818
steps:
19-
- uses: actions/checkout@v1
20-
21-
- uses: r-lib/actions/setup-r@v2
22-
with:
23-
crayon.enabled: 'FALSE'
24-
r-version: '4.2.3'
19+
- uses: actions/checkout@v4
2520

2621
- uses: actions/cache@v1
2722
with:
@@ -30,8 +25,17 @@ jobs:
3025
restore-keys: |
3126
${{ runner.os }}-renv-
3227
28+
- uses: r-lib/actions/setup-r@v2
29+
with:
30+
use-public-rspm: true
31+
crayon.enabled: 'FALSE'
32+
r-version: '4.1.0'
33+
Ncpus: 4
34+
3335
- uses: r-lib/actions/setup-pandoc@v2
3436

37+
- uses: r-lib/actions/setup-renv@v2
38+
3539
- name: Install tinytex
3640
uses: r-lib/actions/setup-tinytex@v2
3741

@@ -49,8 +53,8 @@ jobs:
4953
- name: Spell check
5054
run: Rscript before-build-spellcheck.R
5155
env:
52-
EMAIL: ${{ secrets.EMAIL }} # must be a verified email
53-
GH_TOKEN: ${{ secrets.TOKEN }} # https://github.com/settings/tokens
56+
EMAIL: ${{ secrets.EMAIL }}
57+
GH_TOKEN: ${{ secrets.TOKEN }}
5458

5559
- name: Before build
5660
run: Rscript prep.R

redirect.R

+6-36
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ redirects <- yaml::read_yaml("_output.yml")$redirects
55

66
make_redirect <- function(from, to){
77
html <- sprintf(
8-
'<head><meta http-equiv="refresh" content="0; URL=%s.html" /></head>',
8+
'<head><meta http-equiv="refresh" content="0; URL=%s.html" /></head>',
99
to
1010
)
1111
dest <- fs::path("_site", from, ext = "html")
@@ -15,55 +15,25 @@ make_redirect <- function(from, to){
1515

1616
mapply(make_redirect, from = names(redirects), to = redirects)
1717

18-
# make_redirect_apps <- function(name, url){
19-
# fs::dir_create(
20-
# fs::path(
21-
# "redirects",
22-
# name
23-
# )
24-
# )
25-
# fls <- fs::path(
26-
# "_site",
27-
# name,
28-
# "index.html"
29-
# )
30-
# fs::file_create(
31-
# fls
32-
# )
33-
# write(file = fls,
34-
# sprintf('<head><meta http-equiv="refresh" content="0; URL=%s" /></head>', url)
35-
# )
36-
# }
37-
38-
# make_redirect_apps("tidytuesday201942", "https://connect.thinkr.fr/tidytuesday201942/")
39-
# make_redirect_apps("hexmake", "https://connect.thinkr.fr/hexmake/")
40-
# make_redirect_apps("minifying", "https://connect.thinkr.fr/minifying/")
41-
# make_redirect_apps("golemhtmltemplate", "https://connect.thinkr.fr/golemhtmltemplate/")
42-
# make_redirect_apps("shinipsumdemo", "https://connect.thinkr.fr/shinipsumdemo/")
43-
# make_redirect_apps("databasedemo", "https://connect.thinkr.fr/databasedemo/")
44-
# make_redirect_apps("graysacle", "https://connect.thinkr.fr/graysacle/")
45-
# make_redirect_apps("bs4dashdemo", "https://connect.thinkr.fr/bs4dashdemo/")
46-
# make_redirect_apps("shinyfuture", "https://connect.thinkr.fr/shinyfuture/")
47-
4818
# Creating the redirect
4919
unlink("redirects", TRUE, TRUE)
5020

5121
make_redirect <- function(name, url){
5222
fs::dir_create(
5323
fs::path(
54-
"redirects",
24+
"redirects",
5525
name
5626
)
5727
)
5828
fls <- fs::path(
59-
"redirects",
60-
name,
29+
"redirects",
30+
name,
6131
"index.html"
6232
)
6333
fs::file_create(
6434
fls
6535
)
66-
write(file = fls,
36+
write(file = fls,
6737
sprintf('<head><meta http-equiv="refresh" content="0; URL=%s" /></head>', url)
6838
)
6939
}
@@ -88,7 +58,7 @@ try({
8858
dirs
8959
)){
9060
fs::dir_copy(
91-
i,
61+
i,
9262
fs::path("_site", basename(i))
9363
)
9464
}

0 commit comments

Comments
 (0)