Merge pull request #54 from suzanneEmbury/suzanneEmbury-team-cw2-update #105
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
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 |