Dev (#147) #211
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: | |
- 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 |