Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/quarto-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Render and Publish

on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

permissions:
contents: write
pages: write

jobs:
build-deploy:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Check out repository
uses: actions/checkout@v4

# The reference pages and the installed package come from the same
# checkout, so the docs always match the code that runs the examples.
- name: Check out segue
uses: actions/checkout@v4
with:
repository: posit-dev/segue
path: _packages/segue

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true

# Packages the pages run, plus packages that downlit links to. downlit
# links `pkg::fun()` to the function's page only when pkg is installed.
# dplyr, tidyr, ggplot2, broom, rlang, tibble and vctrs come in as
# dependencies of tidyverse or segue.
- name: Install R packages
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: >
local::./_packages/segue
any::cli
any::downlit
any::gt
any::haven
any::knitr
any::modeldata
any::pak
any::pkgsite
any::rmarkdown
any::scales
any::tidyverse
any::xml2

- name: Build reference pages
run: Rscript _pkgsite/build.R _packages/segue

# Pull requests only render, to check that the site builds.
- name: Render site
if: github.event_name == 'pull_request'
uses: quarto-dev/quarto-actions/render@v2

- name: Render and publish to GitHub Pages
if: github.event_name != 'pull_request'
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
# stray vsub output when run from the repo root
/*.log
/*.lst
/_freeze/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The R code runs when the site is built, so you need R with segue installed:

```r
pak::pak("posit-dev/segue")
install.packages(c("dplyr", "tidyr", "ggplot2", "knitr", "haven"))
install.packages(c("tidyverse", "gt", "scales", "cli", "knitr", "rmarkdown", "modeldata", "haven", "downlit", "xml2"))
```

Then, from this folder:
Expand All @@ -23,7 +23,7 @@ Or preview with live reload:
quarto preview
```

Results are frozen in `_freeze/` (`freeze: auto`), so a page re-runs only when its source changes.
Locally, results are cached in `_freeze/` (`freeze: auto`), so a page re-runs only when its source changes. `_freeze/` is not committed: the GitHub Actions workflow in `.github/workflows/quarto-site.yaml` runs all the code on each push to `main` and publishes the site to the `gh-pages` branch.

## Data

Expand All @@ -35,7 +35,7 @@ Rscript data-raw/prepare-data.R ../r-to-sas-comparisons

## Reference pages

The pages in `reference/` are written by [pkgsite](https://edgararuiz.github.io/pkgsite/) from segue's `.Rd` help files. Don't edit them by hand: rebuild them whenever segue's documentation changes.
The pages in `reference/` are written by [pkgsite](https://edgararuiz.github.io/pkgsite/) from segue's `.Rd` help files. Don't edit them by hand. The GitHub Actions workflow rebuilds them from the latest segue on every publish, so you only need to rebuild them locally to preview changes.

```r
install.packages("pkgsite")
Expand Down
17 changes: 0 additions & 17 deletions _freeze/comparisons/binomial-exact-test/execute-results/html.json

This file was deleted.

Binary file not shown.
17 changes: 0 additions & 17 deletions _freeze/comparisons/binomial-score-test/execute-results/html.json

This file was deleted.

Binary file not shown.
Loading
Loading