2020-10-03 21:26:36 +08:00
|
|
|
on:
|
|
|
|
push:
|
2022-01-04 05:28:15 +08:00
|
|
|
branches: [main, master]
|
2020-10-07 05:17:30 +08:00
|
|
|
pull_request:
|
2022-01-04 05:28:15 +08:00
|
|
|
branches: [main, master]
|
|
|
|
workflow_dispatch:
|
2020-10-07 05:17:30 +08:00
|
|
|
schedule:
|
|
|
|
# run every day at 11 PM
|
|
|
|
- cron: '0 23 * * *'
|
2020-10-03 21:26:36 +08:00
|
|
|
|
2020-10-09 19:52:41 +08:00
|
|
|
name: Build book
|
2020-10-03 21:26:36 +08:00
|
|
|
|
2020-10-03 21:51:47 +08:00
|
|
|
env:
|
|
|
|
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
|
|
|
|
|
2020-10-03 21:26:36 +08:00
|
|
|
jobs:
|
|
|
|
build:
|
2022-01-04 05:28:15 +08:00
|
|
|
runs-on: ubuntu-latest
|
2020-10-03 21:26:36 +08:00
|
|
|
env:
|
|
|
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
2022-01-04 05:28:15 +08:00
|
|
|
- uses: actions/checkout@v2
|
2020-10-03 21:26:36 +08:00
|
|
|
|
2022-01-04 05:28:15 +08:00
|
|
|
- uses: r-lib/actions/setup-pandoc@v2
|
2020-10-03 21:26:36 +08:00
|
|
|
|
2022-01-04 05:28:15 +08:00
|
|
|
- uses: r-lib/actions/setup-r@v2
|
2020-10-03 21:26:36 +08:00
|
|
|
with:
|
2022-01-04 05:28:15 +08:00
|
|
|
use-public-rspm: true
|
2020-10-03 21:26:36 +08:00
|
|
|
|
2022-01-04 05:28:15 +08:00
|
|
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
2020-10-03 21:26:36 +08:00
|
|
|
|
|
|
|
- name: Cache bookdown results
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: _bookdown_files
|
2020-10-09 19:52:41 +08:00
|
|
|
key: bookdown-3-${{ hashFiles('**/*Rmd') }}
|
|
|
|
restore-keys: bookdown-3-
|
2020-10-03 21:26:36 +08:00
|
|
|
|
|
|
|
- name: Build site
|
2020-10-06 00:28:01 +08:00
|
|
|
run: |
|
|
|
|
# Allows [implcit heading links] to work; will need to convert
|
|
|
|
# to explicit before switching to visual editor
|
|
|
|
options(bookdown.render.file_scope = FALSE)
|
2020-10-07 05:59:22 +08:00
|
|
|
bookdown::render_book("index.Rmd")
|
2020-10-06 00:28:01 +08:00
|
|
|
shell: Rscript {0}
|
2020-10-03 21:26:36 +08:00
|
|
|
|
|
|
|
- name: Deploy to Netlify
|
2020-10-03 21:51:47 +08:00
|
|
|
if: contains(env.isExtPR, 'false')
|
|
|
|
id: netlify-deploy
|
|
|
|
uses: nwtgck/actions-netlify@v1.1
|
|
|
|
with:
|
|
|
|
publish-dir: './_book'
|
2021-12-08 22:17:42 +08:00
|
|
|
production-branch: main
|
2020-10-03 21:51:47 +08:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
deploy-message:
|
|
|
|
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})'
|
|
|
|
enable-pull-request-comment: false
|
|
|
|
enable-commit-comment: false
|
2020-10-03 21:26:36 +08:00
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
2021-02-05 05:23:41 +08:00
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_2E }}
|
2020-10-03 21:51:47 +08:00
|
|
|
timeout-minutes: 1
|