I adapted my workflow slightly from usethis::use_github_action("bookdown"):
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
name: bookdown
jobs:
bookdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r@v1
with:
use-public-rspm: true
- name: Install curl
run: sudo apt-get install libcurl4-openssl-dev
- uses: r-lib/actions/setup-tinytex@v1
- uses: r-lib/actions/setup-renv@v1
- name: Cache bookdown results
uses: actions/cache@v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", output_format = "all", quiet = TRUE)'
- name: Deploy to GitHub pages 🚀
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: docs
I ran into the error failed to retrieve package 'localPackage'when it got to the r-lib/actions/setup-renv@v1 step because renv does not correctly restore localPackage from RENV_PATHS_LOCAL, set in my local .Renviron. So, my question is whether we are able to pass this environment variable to the workflow. I've tried the following 2 modifications to no avail:
Attempt 1:
jobs:
bookdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RENV_PATHS_LOCAL: ~/Packages
Attempt 2:
- name: renv local
shell: bash
run: |
echo "RENV_PATHS_LOCAL=~/Packages" >> $GITHUB_ENV
- uses: r-lib/actions/setup-renv@v1