|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This repository provides three GitHub Actions for working with Quarto: |
| 8 | + |
| 9 | +1. **setup** - Installs Quarto on GitHub Actions runners |
| 10 | +2. **render** - Renders a Quarto project |
| 11 | +3. **publish** - Publishes a Quarto project to various services |
| 12 | + |
| 13 | +The actions are implemented as composite actions (using shell scripts) rather than JavaScript or Docker container actions. |
| 14 | + |
| 15 | +## Architecture |
| 16 | + |
| 17 | +### Action Structure |
| 18 | + |
| 19 | +Each action lives in its own directory with: |
| 20 | +- `action.yml` - Action definition with inputs/outputs |
| 21 | +- `README.md` - User-facing documentation |
| 22 | +- Supporting scripts (e.g., `install-quarto-windows.ps1` for setup action) |
| 23 | + |
| 24 | +All actions use `using: 'composite'` with shell steps, making them OS-agnostic. |
| 25 | + |
| 26 | +### Platform-Specific Installation (setup action) |
| 27 | + |
| 28 | +The setup action handles three platforms differently: |
| 29 | + |
| 30 | +- **Linux**: Downloads `.deb` file (AMD64 or ARM64), installs with `apt` |
| 31 | +- **macOS**: Downloads `.pkg` file, installs with `installer` |
| 32 | +- **Windows**: Uses Scoop package manager via `install-quarto-windows.ps1` (workaround because MSI installation doesn't work in GitHub Actions) |
| 33 | + |
| 34 | +Version handling: |
| 35 | +- `"release"` (default) - Fetches latest stable from `quarto.org/docs/download/_download.json` |
| 36 | +- `"pre-release"` - Fetches latest dev from `quarto.org/docs/download/_prerelease.json` |
| 37 | +- Specific version (e.g., `"1.3.450"`) - Downloads that exact release |
| 38 | + |
| 39 | +### Quarto Binary Detection |
| 40 | + |
| 41 | +The setup action determines the correct binary based on `$RUNNER_OS` and `$RUNNER_ARCH`, setting `BUNDLE_EXT` environment variable to one of: |
| 42 | +- `linux-amd64.deb` |
| 43 | +- `linux-arm64.deb` |
| 44 | +- `macos.pkg` |
| 45 | +- `win.msi` |
| 46 | + |
| 47 | +### Render and Publish Actions |
| 48 | + |
| 49 | +Both actions: |
| 50 | +- Accept a `path` input for subdirectory rendering/publishing |
| 51 | +- Set `QUARTO_PRINT_STACK: true` for better debugging |
| 52 | +- Use bash shells exclusively (even on Windows, leveraging Git Bash) |
| 53 | + |
| 54 | +The publish action: |
| 55 | +- Configures git identity for gh-pages commits |
| 56 | +- Handles multiple publishing targets (gh-pages, Netlify, Quarto Pub, RStudio Connect) |
| 57 | +- Supports `--no-render` flag to skip rendering before publishing |
| 58 | +- Has both `to` and `target` inputs (aliases) for backward compatibility |
| 59 | + |
| 60 | +## Testing |
| 61 | + |
| 62 | +Run tests with: |
| 63 | +```bash |
| 64 | +gh workflow run test.yaml |
| 65 | +``` |
| 66 | + |
| 67 | +The test workflow (`.github/workflows/test.yaml`): |
| 68 | +- Tests on multiple OS/architecture combinations (macOS, Windows, Ubuntu AMD64, Ubuntu ARM) |
| 69 | +- Matrix tests both `release` and `pre-release` versions by default |
| 70 | +- Supports manual dispatch to test specific versions or enable TinyTeX |
| 71 | +- Uses `uses: ./setup` to test the action directly from the working tree |
| 72 | + |
| 73 | +## Version Management |
| 74 | + |
| 75 | +This repository follows GitHub's recommended release management: |
| 76 | +- Major versions (`v2`, `v1`) are moving tags that point to latest minor/patch |
| 77 | +- Specific versions (`v2.0.1`) are immutable |
| 78 | +- Users should use `quarto-dev/quarto-actions/setup@v2` for automatic updates |
| 79 | +- Breaking changes only come with major version bumps |
| 80 | + |
| 81 | +## Windows-Specific Considerations |
| 82 | + |
| 83 | +Windows installation uses Scoop because MSI installation doesn't work reliably in GitHub Actions. The `install-quarto-windows.ps1` script: |
| 84 | +- Installs Scoop if not present |
| 85 | +- Adds the `r-bucket` (maintained by Chris at github.com/cderv/r-bucket.git) |
| 86 | +- Installs Quarto or specific versions through Scoop |
| 87 | +- Adds Scoop shims to `$GITHUB_PATH` |
| 88 | + |
| 89 | +## Common Issues |
| 90 | + |
| 91 | +- **TinyTeX PATH**: After installing TinyTeX, the action adds its binary directory to `$GITHUB_PATH` differently per platform (Linux: `$HOME/bin`, macOS: finds via `~/Library/TinyTeX`, Windows: finds via `$APPDATA/TinyTeX`) |
| 92 | +- **Chromium crashes**: Past issues with Chromium when rendering PDFs (see commented-out Chrome installation steps in render action) |
| 93 | +- **Output directory detection**: Render action attempts to detect `_book` or `_site` output directories |
0 commit comments