Skip to content

Publish Bookdown

Publish Bookdown #4

Workflow file for this run

name: Publish Bookdown
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
on:
workflow_dispatch:
push:
branches: main
paths:
- 'book/**' # Includes all files and subdirectories under 'book/'
- '!_book/**' # Exclude the output directory to avoid unnecessary triggers
jobs:
bookdown:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Set up R environment
- name: Set up R
uses: r-lib/actions/setup-r@v2
# Step 3: Install Pandoc
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
# Step 4: Install R dependencies
- name: Install R Dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
rmarkdown
bookdown
kableExtra
tinytex
update: true
# Step 5: Install Tinytex
- name: Install TinyTeX
run: |
Rscript -e 'if (!tinytex::is_tinytex()) tinytex::install_tinytex()'
# Step 6: Install LaTeX packages
- name: Install LaTeX Packages
run: |
Rscript -e 'tinytex::tlmgr_install(c("xetex", "fontspec", "xunicode", "upquote", "microtype", "hyperref", "amsmath", "geometry", "grffile", "longtable", "wrapfig", "epstopdf", "booktabs", "mdwtools", "multirow", "parskip", "textcomp", "enumitem", "appendix", "titling", "fancyhdr", "tabu", "varwidth"))'
# Step 7: Configure Pages
- name: Setup Pages
uses: actions/configure-pages@v1
# Step 8: Render the Bookdown book
- name: Render Book
run: |
cd book
Rscript -e 'bookdown::render_book("index.Rmd", output_format = "all")'
# Step 9: Upload artifact for Pages deployment
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '_book'
# Step 10: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@main