Skip to content

Merge pull request #14 from jiayiliujiayi/master-1 #41

Merge pull request #14 from jiayiliujiayi/master-1

Merge pull request #14 from jiayiliujiayi/master-1 #41

Workflow file for this run

on:
push:
branches:
- master
name: bookdown
jobs:
build:
name: Render-Book
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@v1
- name: Install pandoc
run: brew install pandoc
- name: Cache Renv packages
uses: actions/cache@v2
with:
path: $HOME/.local/share/renv
key: r-${{ hashFiles('renv.lock') }}
restore-keys: r-
- name: Cache bookdown results
uses: actions/cache@v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Install packages
run: |
R -e 'install.packages(c("renv","rsconnect"))'
R -e 'renv::restore()'
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- name: Update website
uses: actions-go/push@master
with:
commit-message: '[Auto] update github online book preview'
remote: origin
- name: Deploy book to bookdown.org
if: github.event_name == 'push'
env:
CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_ORG_TOKEN }}
CONTENT_ID: 647
run: |
rsconnect::addConnectServer("https://bookdown.org", "bookdown.org")
rsconnect::connectApiUser(account = "yufree", server = "bookdown.org", apiKey = Sys.getenv("CONNECT_API_KEY"))
rsconnect::deploySite(appId = Sys.getenv("CONTENT_ID"), server = "bookdown.org", render = "none", logLevel = "verbose", forceUpdate = TRUE)
shell: Rscript {0}