Skip to content

Render each case study individually #113

Description

@kellijohnson-NOAA

I would like each case study to have its own GitHub action or call a reusable GitHub action to render and create an artifact. The artifacts can then be used to create the website.

Example .yml file to render .qmd file
# .github/workflows/render-page-a.yml
name: Render Page A

on:
  push:
    branches: [ main ]
    paths:
      - 'pages/page-a.qmd' # Only trigger if this file changes
  schedule:
    - cron: '0 2 * * *' # Run daily at 2 AM UTC
  workflow_dispatch: # Allows manual triggering

jobs:
  render-single:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Set up Quarto
        uses: quarto-dev/quarto-actions/setup@v2

      # Add your R/Python setup steps here if your Quarto files use code chunks
      
      - name: Render Single Quarto File
        run: |
          quarto render pages/page-a.qmd

      # Upload the rendered HTML/assets so the deployment workflow can grab them
      - name: Upload Page Artifact
        uses: actions/upload-artifact@v4
        with:
          name: page-a-output
          path: pages/page-a.html # Adjust path based on where Quarto outputs it

Then create a "Central" deploy workflow to create the github.io site.

Example central workflow
# .github/workflows/deploy-site.yml
name: Deploy Website

on:
  workflow_run:
    workflows: ["Render Page A", "Render Page B"] # Add all your workflow names here
    types:
      - completed

jobs:
  deploy:
    # CRITICAL: Only deploy if the triggering workflow was successful
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      # 1. Download all the latest artifacts
      # GitHub actions/download-artifact by default can download all artifacts from the run
      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: _site/ # Or wherever your Quarto site structure expects them

      # 2. Deploy to GitHub Pages
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./_site # Adjust to your main site output directory

Somewhere in this action, the table status on the README will need to be updated but I am not entirely sure how that works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: refactorRestructure code to improve the implementation

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions