Skip to content

Build & Deploy Website #1310

Build & Deploy Website

Build & Deploy Website #1310

Workflow file for this run

---
name: Build & Deploy Website
on:
workflow_call:
secrets:
REPO_GITHUB_TOKEN:
description: |
Github token with write access to the repository
required: false
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
schedule:
- cron: "10 10 * * *"
workflow_dispatch:
jobs:
build-deploy:
name: Build & Deploy Website
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.title, '[skip website]')"
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Cache artifacts
uses: actions/cache@v4
with:
path: _freeze
key: ${{ runner.os }}-examples
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install Jupyter
run: python3 -m pip install jupyter
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup R Dependencies
uses: r-lib/actions/setup-r-dependencies@v2
- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
to: html
- name: Publish docs
# runs when main branch is updated, or when a PR is merged into main
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
- name: Publish PR docs in a subdirectory
# runs when a PR is opened or updated, but not when merged into main
if: github.event_name == 'pull_request' && github.base_ref == 'main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
destination_dir: ${{ github.head_ref }}
- name: Create comment
# runs when a PR is opened or updated, but not when merged into main
if: github.event_name == 'pull_request' && github.base_ref == 'main'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: "Documentation Website"
message: |
The website is available at https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ github.head_ref }}.
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}