Skip to content

use github's cache workflow #648

use github's cache workflow

use github's cache workflow #648

Workflow file for this run

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
name: build-website
jobs:
build-website:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- id: setup
uses: r-lib/actions/setup-r@v2
- uses: quarto-dev/quarto-actions/setup@v2
with:
version: pre-release
- name: Cache R packages
uses: actions/cache@v3
with:
path: ~/.cache/R/renv
key: ${{ runner.os }}-r-${{ steps.setup.outputs.installed-r-version }}-lock-${{ hashFiles('mlr-org/renv.lock') }}
restore-keys: ${{ runner.os }}-r-${{ steps.setup.outputs.installed-r-version }}-lock-
- name: Install System Dependencies
uses: mlr-org/actions/renv-system-dependencies@v1
with:
path: 'mlr-org/renv.lock'
- name: Restore renv environment
run: |
cd mlr-org
R -q -e 'options(Ncpus = 2); install.packages("renv", repos = "cloud.r-project.org"); renv::restore()'
- name: Render site
run: quarto render mlr-org/
- name: Deploy netlify preview
if: ${{ github.event_name == 'pull_request' }}
uses: mlr-org/actions/quarto-netlify-preview@v1
with:
netlify_auth_token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify_site_id: ${{ secrets.NETLIFY_SITE_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
path: mlr-org/_site
netlify_url: mlr3website.netlify.app
- name: Deploy
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
git-config-name: mlr-org
git-config-email: <>
commit-message: 'deploy website'
branch: gh-pages
folder: mlr-org/_site
single-commit: true