Skip to content

Commit

Permalink
Use GHA workflow from Mastering Shiny
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Aug 13, 2020
1 parent 1ceb01a commit bdb177f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
63 changes: 63 additions & 0 deletions .github/workflows/build-book.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on:
push:
branches: '*'
schedule:
# run every day at 11 PM
- cron: '0 23 * * *'

name: build-book

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

- name: Setup R
uses: r-lib/actions/setup-r@master
with:
r-version: 'release'

- 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-4-${{ hashFiles('DESCRIPTION') }}
restore-keys: r-4-

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

- name: Install packages
run: |
R -e 'install.packages("remotes")'
R -e 'install.packages("ps", type = "binary")'
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_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
npm install netlify-cli -g
netlify deploy --prod --dir _book

0 comments on commit bdb177f

Please sign in to comment.