Skip to content

Commit

Permalink
Build with GitHub Actions (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester authored and hadley committed Jan 20, 2020
1 parent 3d1470a commit 1bcd54b
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-book.yaml
@@ -0,0 +1,57 @@
on:
push:
branches: '*'
schedule:
# run every day at 11 PM
- cron: '0 23 * * *'

jobs:
build:
runs-on: macOS-latest
steps:
- name: Checkout repo
uses: actions/checkout@master

- name: Setup R
uses: r-lib/actions/setup-r@master

- name: Install pandoc and pandoc citeproc
run: |
brew install pandoc
brew install pandoc-citeproc
- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: r-${{ hashFiles('DESCRIPTION') }}
restore-keys: r-

- name: Cache bookdown results
uses: actions/cache@v1
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-

- name: Install packages
run: |
R -e 'install.packages("remotes")'
R -e 'remotes::install_deps(dependencies = TRUE)'
- name: Install PhantomJS
run: R -e 'webshot::install_phantomjs()'

- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'

- name: Install npm
uses: actions/setup-node@v1

- name: Deploy to Netlify
# NETLIFY_AUTH_TOKEN added in the repo's secrets
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
npm install netlify-cli -g
netlify deploy --prod --dir _book

0 comments on commit 1bcd54b

Please sign in to comment.