Skip to content

bookdown

bookdown #348

Workflow file for this run

on:
push:
branches:
- main
- master
schedule:
# run every Saturday at 8am (12 UTC)
- cron: '0 12 * * 6'
name: bookdown
jobs:
build:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Cache bookdown results
uses: actions/cache@v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-2-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-2-
- name: Install dependencies
run: |
pak::local_install_dev_deps()
shell: Rscript {0}
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- uses: actions/upload-artifact@v2
with:
name: _book
path: _book/
# add secret for EMAIL to the repository
# gh-action from Cecilapp/GitHub-Pages-deploy
checkout-and-deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download artifact
uses: actions/download-artifact@v2
with:
# Artifact name
name: _book # optional
# Destination path
path: _book/ # optional
- name: Deploy to GitHub Pages
uses: Cecilapp/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
email: ${{ secrets.EMAIL }}
build_dir: _book