Create FUNDING.yml #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
name: build-book | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Setup pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '2.17.1.1' | |
- name: Install TinyTeX | |
uses: r-lib/actions/setup-tinytex@v2 | |
env: | |
# install full prebuilt version | |
TINYTEX_INSTALLER: TinyTeX | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
needs: book | |
- name: Install missing system dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt-get install -y libgtk2.0-dev asymptote | |
- name: Install phantomjs | |
run: | | |
webshot::install_phantomjs() | |
shell: Rscript {0} | |
- name: Build Gitbook | |
if: github.event_name == 'pull_request' | |
run: make gitbook | |
- name: Build and Deploy all book | |
if: github.event_name == 'push' | |
env: | |
CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_ORG_TOKEN }} | |
CONTENT_ID: 7b3dedfa-fd98-45dd-bec4-75d915fb27dd | |
run: make all | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'push' | |
env: | |
URL: https://bookdown.org/yihui/rmarkdown-cookbook/ | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.repos.createCommitStatus({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
sha: context.sha, | |
state: "success", | |
target_url: "${{ env.URL}}", | |
description: "Book deployed!", | |
context: "bookdown.org" | |
}) | |
- name: Upload book folder for debug | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: book-dir | |
path: _book |