Skip to content

.github/workflows/publish.yml #881

.github/workflows/publish.yml

.github/workflows/publish.yml #881

Workflow file for this run

name: Render and publish
on:
push:
branches: [main]
schedule:
# Match window is 15:00-06:00 UTC (hours 15-23 and 0-6); skip the overnight lull.
# Hourly tick (top of the hour): always runs.
- cron: "0 0-6,15-23 * * *"
# Every 10 minutes (excluding :00, covered above): only runs when WORLDCUP26_LIVE is true.
- cron: "10,20,30,40,50 0-6,15-23 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
render:
runs-on: ubuntu-latest
# The hourly tick (cron "0 ...") and manual/push runs always proceed; the
# 10-min ticks only proceed when the repo variable WORLDCUP26_LIVE is "true".
if: >
github.event_name != 'schedule' ||
github.event.schedule == '0 0-6,15-23 * * *' ||
vars.WORLDCUP26_LIVE == 'true'
env:
FOOTBALL_DATA_API_KEY: ${{ secrets.FOOTBALL_DATA_API_KEY }}
WORLDCUP26_LIVE: ${{ vars.WORLDCUP26_LIVE }}
# Optional: set this repo variable to a deployed Cloudflare Worker URL to
# render the client-side "Update scores" button (see worker/README.md).
# Leave it unset to keep the button off; the site is unaffected.
WORLDCUP26_SCORE_PROXY_URL: ${{ vars.WORLDCUP26_SCORE_PROXY_URL }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
# Only hard deps (Imports) plus what Quarto needs to render index.qmd.
# The default ("all") also installs Suggests (shiny, ellmer, querychat,
# bslib, testthat, ...), which the static site never uses. Caching is on
# by default; trimming the set speeds up both cold installs and restores.
dependencies: '"hard"'
extra-packages: |
any::rmarkdown
any::knitr
any::jsonlite
local::.
- name: Render site
run: quarto render
- name: Build downloadable data files
run: Rscript data-raw/publish_data.R
- name: Publish to gh-pages
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
render: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}