Make deploy-preview equal to master #51
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: Render Book on PR to Main | |
on: | |
workflow_dispatch: # Allows the workflow to be triggered manually | |
pull_request_target: | |
types: [closed] | |
branches: | |
- deploy-preview | |
jobs: | |
render-and-commit: | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'deploy-preview' && 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 | |
with: | |
ref: deploy-preview | |
- name: Fetch latest changes | |
run: | | |
git fetch origin | |
git reset --hard origin/deploy-preview | |
- 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 Bioconductor packages | |
# run: | | |
# Rscript -e 'install.packages("babelquarto", repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org"))' | |
# Rscript -e 'install.packages("babeldown", repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org"))' | |
# Rscript -e 'renv::snapshot()' | |
- 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: Fix locale | |
run: | | |
export LANG=en_US.UTF-8 | |
export LC_CTYPE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
- name: Render the book | |
# uses: quarto-dev/quarto-actions/render@v2 | |
run: Rscript -e 'source("quarto_runfile.R")' | |
continue-on-error: true | |
# - name: Render the book | |
# run: Rscript -e 'library(babelquarto); babelquarto::render_book()' | |
# 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 deploy-preview || 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 }} |