-
Notifications
You must be signed in to change notification settings - Fork 1.3k
106 lines (91 loc) · 3.09 KB
/
Book.yaml
File metadata and controls
106 lines (91 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches: [main, master]
paths:
- 'inst/examples/**'
- 'inst/resources/**'
- 'inst/rmarkdown/**'
- 'inst/templates/**'
- 'R/**'
- '.github/workflows/Book.yaml'
pull_request:
branches: [main, master]
paths:
- 'inst/examples/**'
- 'inst/resources/**'
- 'inst/rmarkdown/**'
- 'inst/templates/**'
- 'R/**'
- '.github/workflows/Book.yaml'
workflow_dispatch:
inputs:
publish:
description: 'publish the book to github pages for connect cloud deployment'
required: false
default: false
type: boolean
name: Build and deploy book
concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KNITR_OPTIONS: "knitr.chunk.tidy=TRUE"
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Install R
uses: r-lib/actions/setup-r@v2
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: latest
- name: Install TinyTeX
uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX
- name: Install OS dependencies
run: |
brew update
brew install --cask xquartz
brew install --cask calibre
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: local::.
needs: book
- name: Install phamtomJS for webshot
run: |
webshot::install_phantomjs()
shell: Rscript {0}
- name: Cache bookdown results
uses: actions/cache@v4
with:
path: inst/examples/_bookdown_files
key: bookdown-${{ hashFiles('inst/examples/*Rmd') }}
restore-keys: bookdown-
- name: Build all book formats
run: make -C inst/examples all
- name: Deploy Gitbook to gh-pages
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: inst/examples/_book
clean: true
single-commit: true
dry-run: ${{ (github.event_name == 'workflow_dispatch' && (github.event.inputs.publish == 'false' || github.event.inputs.publish == false)) || false }}
- name: Upload book folder for debug
if: failure()
uses: actions/upload-artifact@main
with:
name: book-dir
path: inst/examples