Skip to content

Commit

Permalink
build pkgdown previews on every PR (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman authored Dec 9, 2024
1 parent f4331cc commit 8f5e3b8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
on:
push:
branches: main
pull_request:
branches: main
release:
types: [published]
workflow_dispatch:
Expand Down Expand Up @@ -45,6 +43,10 @@ jobs:
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs
clean: true
force: false
clean-exclude: |
pr-preview/
dev/
44 changes: 44 additions & 0 deletions .github/workflows/pr-preview-pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

name: pr-preview-pkgdown.yml

concurrency: preview-${{ github.ref }}

jobs:
pkgdown:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy PR preview to GitHub pages
if: ${{ github.event_name == 'pull_request' }}
uses: rossjrw/pr-preview-action@v1
with:
source-dir: docs
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto

0 comments on commit 8f5e3b8

Please sign in to comment.