Preview of PRs #6
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
name: Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
permissions: | |
contents: write | |
concurrency: | |
group: "deploy" | |
cancel-in-progress: true | |
env: | |
RENV_PATHS_ROOT: ~/.cache/R/renv | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: "Setup R" | |
uses: r-lib/actions/setup-r@v2 | |
- name: Cache packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.RENV_PATHS_ROOT }} | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Restore packages | |
shell: Rscript {0} | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
- uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
version: pre-release | |
tinytex: false | |
- name: Render Quarto Project | |
shell: bash | |
env: | |
GH_PAGES: gh-pages | |
run: | | |
git config --local user.name github-actions[bot] | |
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com | |
quarto render | |
git fetch origin "${GH_PAGES}" | |
git checkout origin/"${GH_PAGES}" -- preview | |
mv preview _book/ | |
quarto publish gh-pages --no-prompt --no-render --no-browser |