Skip to content

follow up

follow up #137

Workflow file for this run

on:
push:
branches:
- master
paths-ignore:
- 'examples/**'
- 'Dockerfile'
pull_request:
branches:
- master
name: Render-Book
env:
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (r-${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macos-14, r: '4.4.0'}
env:
LANG: "en_US.UTF-8"
TZ: "Asia/Shanghai"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '3.1.11'
- name: Install ghostscript and Others
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew update
brew install poppler optipng graphviz
brew install --cask xquartz
brew install --cask font-inconsolata font-dejavu
- name: Install TinyTeX
uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX
- name: Install LaTeX Packages
run: |
tinytex::tlmgr_install(readLines("texlive.txt"))
shell: Rscript {0}
- name: Install Fonts
run: |
library(showtext)
font_install(source_han_serif(), quiet = TRUE)
font_install(source_han_sans(), quiet = TRUE)
shell: Rscript {0}
- name: Add Fonts
run: |
curl -fLo Adobe-Fonts.zip https://github.com/XiangyunHuang/fonts/releases/download/v0.1/Adobe-Fonts.zip
unzip Adobe-Fonts.zip -d ~/Library/Fonts/adobe
fc-cache -fsv
- name: Test Pkgs
run: |
sessionInfo(.packages(T))
capabilities()
library(tikzDevice)
tikzTest()
tikzTest("$\\sin(x^2/2 - y^2/4 + 3) \\cos(2 x + 1 - \\exp(y))$")
shell: Rscript {0}
- name: Render Book
id: render-book
run: |
bookdown::render_book("index.Rmd", "all")
shell: Rscript {0}
- name: Cp Graphics
run: |
mkdir -p _book/interactives && cp -r interactives/* _book/interactives
- name: Upload book folder for debug
if: failure()
uses: actions/upload-artifact@v4
with:
name: Upload Book
path: _book
- name: Deploy book to bookdown.org
if: github.event_name == 'push'
env:
CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_ORG_TOKEN }}
CONTENT_ID: 2868
run: |
Rscript '_deploy-book.R'
# 先本地创建一个 Github Pages 分支推送上来才行
# https://bookdown.org/yihui/bookdown/github.html
- name: Checkout the gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: book-output
- name: Deploy to Github Pages
if: ${{ github.ref == 'refs/heads/master' }}
run: ./_deploy.sh