-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (65 loc) · 1.96 KB
/
bookdown-github.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
on:
push:
branches: main
pull_request:
branches: main
# to be able to trigger a manual build
workflow_dispatch:
env:
RENV_PATHS_ROOT: ~/renv
permissions:
contents: write
name: Render and deploy Book
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: cmdstan env vars
run: |
echo "CMDSTAN_PATH=${HOME}/.cmdstan" >> $GITHUB_ENV
shell: bash
- uses: actions/checkout@v3
- name: update
run: sudo apt-get update
- name: Install curl
run: sudo apt-get install -y libcurl4-openssl-dev
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install -y \
libudunits2-dev \
libproj-dev \
libgdal-dev \
libgeos-dev
- name: Install Pandoc
if: ${{ ! github.event.inputs.ghpages }}
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.17.1.1'
- uses: r-lib/actions/setup-renv@v2
- name: Cache bookdown results
uses: actions/cache@v1
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Install cmdstan
run: |
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2)
shell: Rscript {0}
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- name: Deploy 🚀
# only deploy when push to main
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
# The branch the action should deploy to.
branch: gh-pages
# The folder the action should deploy. Adapt if you changed in Quarto config
folder: _book