Skip to content

Commit c824870

Browse files
authored
Update pkgdown workflow for GitHub Pages deployment
1 parent 1c95457 commit c824870

1 file changed

Lines changed: 31 additions & 33 deletions

File tree

.github/workflows/pkgdown.yaml

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
13
on:
24
push:
3-
branches:
4-
- master
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
510

6-
name: pkgdown
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
714

815
jobs:
916
pkgdown:
1017
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
1121
env:
1222
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
1325
steps:
14-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
1527

16-
- uses: actions/setup-node@v2
17-
with:
18-
node-version: '16'
28+
- uses: r-lib/actions/setup-pandoc@v2
1929

2030
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
2133

22-
- uses: r-lib/actions/setup-pandoc@v2
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
2338

24-
- name: Query dependencies
25-
run: |
26-
install.packages('remotes')
27-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
28-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
2941
shell: Rscript {0}
3042

31-
- name: Restore R package cache
32-
uses: actions/cache@v4
43+
- name: Deploy to GitHub pages 🚀
44+
if: github.event_name != 'pull_request'
45+
uses: JamesIves/github-pages-deploy-action@v4.5.0
3346
with:
34-
path: ${{ env.R_LIBS_USER }}
35-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
36-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
37-
38-
- name: Install dependencies
39-
run: |
40-
remotes::install_deps(dependencies = TRUE)
41-
install.packages("pkgdown", type = "binary")
42-
shell: Rscript {0}
43-
44-
- name: Install package
45-
run: R CMD INSTALL .
46-
47-
- name: Deploy package
48-
run: |
49-
git config --local user.email "actions@github.com"
50-
git config --local user.name "GitHub Actions"
51-
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
47+
clean: false
48+
branch: gh-pages
49+
folder: docs

0 commit comments

Comments
 (0)