language: r
sudo: false
cache:
  packages: true
  directories:
  - _bookdown_files
  - $HOME/.npm

addons:
  apt:
    packages:
    - libgsl0-dev
    - libxml2-dev
    - libudunits2-dev
    - optipng

before_install:
- nvm install stable
- npm install netlify-cli -g

script:
- Rscript -e 'bookdown::render_book("index.Rmd")'
- Rscript -e 'xfun::optipng()'

deploy:
  provider: script
  script: netlify deploy --prod --dir _book
  skip_cleanup: true
