-
Notifications
You must be signed in to change notification settings - Fork 17
91 lines (76 loc) · 2.6 KB
/
main.yaml
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
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
name: bookdown
jobs:
bookdown:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'skip build')"
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GDTOOLS_CACHE_DIR: "/usr/share/fonts/gfonts/"
steps:
- uses: actions/checkout@v2
- run: echo "BRANCH_NAME=${{ github.event.pull_request && github.head_ref || github.ref_name }}" >> $GITHUB_ENV
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX
- name: Add some R options for later steps
run: |
cat("\noptions(tinytex.verbose = TRUE)\n", file = "~/.Rprofile", append = TRUE)
cat(readLines("~/.Rprofile"), sep = "\n")
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::remotes
working-directory: 'tools/fakepkg'
- name: Google fonts cache
run: |
gdtools::init_fonts_cache()
shell: Rscript {0}
- name: "Install 'Google Fonts'"
run: |
fontreq=$(Rscript -e "cat(gdtools::install_gfont_script(family = 'Open Sans'))")
sudo -s eval "$fontreq"
shell: bash
- name: Pandoc and Tinytex info
run: |
rmarkdown::find_pandoc()
tinytex::tlmgr("--version")
tinytex::tl_pkgs()
shell: Rscript {0}
- name: render book
run: |
setwd('tables-book')
rmarkdown::render_site(encoding = 'UTF-8')
shell: Rscript {0}
- name: Deploy main 🚀
if: env.BRANCH_NAME == 'main'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: tables-book/_book/
TARGET_FOLDER: '.' # The folder the action should deploy.
CLEAN: true
- name: Deploy any but not main
if: env.BRANCH_NAME != 'main'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: tables-book/_book/
TARGET_FOLDER: ${{ env.BRANCH_NAME }} # The folder the action should deploy.
CLEAN: false