Quarto Publish #19123
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
on: | |
workflow_dispatch: | |
push: | |
branches: main | |
schedule: | |
## Run once every 10 minutes | |
- cron: '*/10 * * * *' | |
name: Quarto Publish | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Cache R packages | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-r-packages | |
- name: Install R dependencies | |
run: | | |
pkgs <- c("ciw", "dplyr", "DT", "ggplot2", "patchwork", "tidyr", "knitr", "lubridate", "forcats", "remotes") | |
pkgs <- unique(pkgs) | |
pkgs <- pkgs[!sapply(pkgs, FUN = requireNamespace)] | |
install.packages(pkgs) | |
install.packages("cransays", repos = c("https://bisaloo.r-universe.dev", getOption("repos"))) | |
shell: Rscript {0} | |
- name: Session information | |
run: | | |
quarto --version | |
Rscript --version | |
- name: Render | |
uses: quarto-dev/quarto-actions/render@v2 | |
- name: Did output HTML files change? | |
id: changed | |
run: | | |
git fetch origin gh-pages:gh-pages --depth=1 | |
git checkout -f gh-pages | |
publish=false | |
for file in $(cd _site/; find . -name "*.html"); do | |
echo "${file}:" | |
diff -u -w "${file}" "_site/${file}" || publish=true | |
done | |
git checkout -f main | |
echo "publish=${publish}" | |
echo "publish=${publish}" >> "${GITHUB_OUTPUT}" | |
- name: Publish | |
if: ${{ steps.changed.outputs.publish == 'true' }} | |
uses: quarto-dev/quarto-actions/publish@v2 | |
with: | |
render: "false" | |
target: gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |