-
Notifications
You must be signed in to change notification settings - Fork 9
62 lines (51 loc) · 1.55 KB
/
deploy_to_netlify.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
on:
push:
branches: main
env:
RENV_PATHS_ROOT: ~/.local/share/renv
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install pandoc
run: |
sudo apt install pandoc
sudo apt install pandoc-citeproc
- name: Cache bookdown results
uses: actions/cache@v1
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Cache packages
uses: actions/cache@v1
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore packages
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::restore()
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd")'
- name: Install npm
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install netlify-cli
run: |
npm install netlify-cli -g
- name: Deploy to Netlify
# NETLIFY_AUTH_TOKEN added in the repo's secrets
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
netlify deploy --prod --dir _book