-
-
Notifications
You must be signed in to change notification settings - Fork 59
95 lines (78 loc) · 2.89 KB
/
build-book.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
name: build-book
jobs:
build-book:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- id: setup
uses: r-lib/actions/setup-r@v2
- uses: quarto-dev/quarto-actions/setup@v2
with:
tinytex: true
- name: Install headless chromium
run: quarto tools install chromium
- name: Cache R packages
uses: pat-s/always-upload-cache@v3
with:
path: ~/.cache/R/renv
key: ${{ runner.os }}-r-${{ steps.setup.outputs.installed-r-version }}-lock-${{ hashFiles('book/renv.lock') }}
restore-keys: ${{ runner.os }}-r-${{ steps.setup.outputs.installed-r-version }}-lock-
- name: Install System Dependencies
uses: mlr-org/actions/renv-system-dependencies@v1
with:
path: 'book/renv.lock'
- name: Restore renv environment
run: |
cd book
R -q -e 'options(Ncpus = 2); install.packages("renv", repos = "cloud.r-project.org"); renv::restore()'
- name: Restore OpenML cache
uses: actions/cache/restore@v3
id: restore-openml-cache
with:
path: book/openml
key: ${{ runner.os }}-openml-${{ hashFiles('./book/chapters/chapter11/large-scale_benchmarking.qmd') }}-${{hashFiles('./book/chapters/appendices/solutions.qmd')}}
restore-keys: ${{ runner.os }}-openml-
- name: Render book
run: quarto render book/ --cache-refresh
- name: Save OpenML cache
uses: actions/cache/save@v3
id: save-openml-cache-manual
with:
path: book/openml
key: ${{ runner.os }}-openml-${{ hashFiles('./book/chapters/chapter11/large-scale_benchmarking.qmd') }}-${{hashFiles('./book/chapters/appendices/solutions.qmd')}}
- name: Add .lycheeignore
run: cp .lycheeignore book/_book/.lycheeignore
- name: Deploy netlify preview
if: ${{ github.event_name == 'pull_request' }}
uses: mlr-org/actions/quarto-netlify-preview@v1
with:
netlify_auth_token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify_site_id: ${{ secrets.NETLIFY_SITE_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
path: book/_book
netlify_url: mlr3book.netlify.app
- name: Upload pdf book
uses: actions/upload-artifact@v3
with:
name: mlr3book
path: book/_book/Applied-Machine-Learning-Using-mlr3-in-R.pdf
retention-days: 1
- name: Deploy
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: book/_book
single-commit: true