Adds compile_script #118
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
on: | |
push: | |
branches: [main, master] | |
name: bookdown | |
jobs: | |
bookdown: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./book/ | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
version: 0.3.71 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install system-wide depencies | |
run: sudo apt-get install -y libgdal-dev libudunits2-dev libmkl-rt libglpk-dev | |
- name: Cache packages renv | |
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 renv | |
shell: Rscript {0} | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
- name: Cache bookdown results | |
uses: actions/cache@v2 | |
with: | |
path: _bookdown_files | |
key: bookdown-${{ hashFiles('**/*Rmd') }} | |
restore-keys: bookdown- | |
- name: Build site | |
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)' | |
- name: Render slides | |
shell: Rscript {0} | |
run: | | |
all_dirs <- fs::dir_ls("slides", type = "directory") | |
all_files <- fs::dir_ls(all_dirs, regexp = "\\.qmd") | |
purrr::walk(all_files, quarto::quarto_render) | |
- name: Move slides to book | |
run: cp -rf ./slides/ ./_book/ | |
- name: Deploy to GitHub pages 🚀 | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: book/_book |