Skip to content

Merge pull request #25 from OuhscBbmc/dependabot/github_actions/James… #84

Merge pull request #25 from OuhscBbmc/dependabot/github_actions/James…

Merge pull request #25 from OuhscBbmc/dependabot/github_actions/James… #84

Workflow file for this run

# Adapted from
# * https://github.com/OuhscBbmc/data-science-practices-1/blob/main/.github/workflows/bookdown.yaml on 2021-10-08
# * https://ropensci.org/blog/2020/04/07/bookdown-learnings/ on 2021-10-08
on:
push:
branches:
- main
- master
name: build-book
jobs:
bookdown:
name: Render-Book
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run:
Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds', version = 2)"
- name: Cache R packages
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-
- name: Install dependencies
run:
Rscript -e "library(remotes)" -e "deps <- readRDS('depends.Rds')" -e "deps[['installed']] <- vapply(deps[['package']], remotes:::local_sha, character(1))" -e "update(deps)"
- name: Render Book
run: Rscript -e 'bookdown::render_book("index.Rmd", output_dir = "docs")'
# This overrides the 'output_dir' value in _bookdown.yaml. It blocks local contributions but allows GitHub Actions to deliver html files where GitHub Pages can serve it.
- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: . # The folder the action should deploy.
clean: true # Default is to "delete files from your deployment destination that no longer exist in your deployment source".