Skip to content

Re-render the update VN version #46

Re-render the update VN version

Re-render the update VN version #46

name: Render Book on PR to Main
on:
workflow_dispatch: # Allows the workflow to be triggered manually
pull_request_target:
types: [closed]
branches:
- master
jobs:
setup-environment-packages:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'handbook_v')
runs-on: ubuntu-latest
continue-on-error: true
env:
RENV_PATHS_ROOT: ~/.cache/R/renv
R_LIBS_USER: ~/.cache/R/renv/Library
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.2'
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install system dependencies and R packages
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev libglpk-dev r-cran-rjava r-base-dev openjdk-11-jdk gdal-bin libgdal-dev libxslt1-dev libgit2-dev libgeos-dev libproj-dev libudunits2-dev libcairo2-dev libxt-dev libmagick++-dev libpoppler-cpp-dev libpq-dev libmysqlclient-dev libsqlite3-dev libssh2-1-dev libgmp3-dev libmpfr-dev libprotobuf-dev protobuf-compiler libgl1-mesa-dev libglu1-mesa-dev libpoppler-glib-dev libtbb-dev libsodium-dev libv8-dev libnetcdf-dev netcdf-bin libjq-dev libharfbuzz-dev libfribidi-dev libnode-dev jq
sudo R CMD javareconf
- name: Set up renv
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 2
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.4.550
# - name: Print packages
# run: Rscript -e 'names(installed.packages()[,3])'
# - name: Render the book
# # uses: quarto-dev/quarto-actions/render@v2
# run: Rscript -e 'source("quarto_runfile.R")'
- name: Render the book
shell: Rscript {0}
run: |
babelquarto::render_book()
continue-on-error: true
render-and-publish:
needs: setup-environment-packages
runs-on: ubuntu-latest
if: success()
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Commit results to main branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "CI added changes `date +'%Y-%m-%d %H:%M:%S'`" || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
# - name: Publish to Netlify
# uses: quarto-dev/quarto-actions/publish@v2
# with:
# target: netlify
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}