diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 49b9b028..455c7dfc 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -15,10 +15,14 @@ jobs: # re-run this job on every subsequent label add. Only react to 'labeled' when it's # this specific label; for other trigger types (synchronize/reopened), fall back to # checking the current label set as before. + # On a PR, `run documentation` is the only trigger. `documentation push preview` is a + # modifier: with `run documentation` present, the build also deploys its preview. if: > github.event_name != 'pull_request' || - (github.event.action == 'labeled' && github.event.label.name == 'run documentation') || - (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run documentation')) + (contains(github.event.pull_request.labels.*.name, 'run documentation') && + (github.event.action != 'labeled' || + github.event.label.name == 'run documentation' || + github.event.label.name == 'documentation push preview')) uses: control-toolbox/CTActions/.github/workflows/documentation.yml@main with: use_ct_registry: true diff --git a/docs/make.jl b/docs/make.jl index 4208a1b4..eb971f3f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -54,4 +54,10 @@ with_api_reference(src_dir, ext_dir) do api_pages end # ═══════════════════════════════════════════════════════════════════════════════ -deploydocs(; repo=repo_url * ".git", devbranch="main") +# PR previews are opt-in: CTActions sets DOCUMENTER_PUSH_PREVIEW to "true" only on a +# PR carrying the `documentation push preview` label. +deploydocs(; + repo=repo_url * ".git", + devbranch="main", + push_preview=get(ENV, "DOCUMENTER_PUSH_PREVIEW", "false") == "true", +)