Rerender #13
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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
on: | |
# Allow manually triggering the workflow via GitHub website, gh CLI tool etc. | |
# Also adds parameter to enable tmate (inetractive tmux session for debugging) | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
push: | |
paths: ['**.Rmd', '**.*tex', '.github/workflows/render-preview.yaml'] | |
name: render-preview | |
jobs: | |
render-preview: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-tinytex@v2 | |
- run: tlmgr --version | |
# Get a tmux ssh session for interactive debugging | |
# Controlled via inputs from GitHub webinterface | |
# See https://github.com/mxschmitt/action-tmate | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Install additional LaTeX packages | |
run: | | |
tlmgr update --self | |
tlmgr install mathtools | |
tlmgr install siunitx | |
tlmgr install doublestroke | |
# tlmgr install xspace bm longtable # contain in TeXLive 'tools' | |
tlmgr install xifthen | |
tlmgr list --only-installed | |
- name: Install R packages for latex-math.Rmd | |
run: | | |
Rscript -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))' | |
Rscript -e "pak::pak(c('rmarkdown', 'xtable', 'stringr'))" | |
- name: Render Rmarkdown files and Commit Results | |
run: | | |
Rscript -e 'rmarkdown::render("latex-math.Rmd")' | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git commit latex-math.pdf -m 'Re-build latex-math.Rmd' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |