|
| 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 |
1 | 3 | on:
|
2 | 4 | push:
|
3 |
| - branches: |
4 |
| - - main |
5 |
| - - master |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + branches: [main, master] |
| 8 | + release: |
| 9 | + types: [published] |
| 10 | + workflow_dispatch: |
6 | 11 |
|
7 | 12 | name: pkgdown
|
8 | 13 |
|
9 | 14 | jobs:
|
10 | 15 | pkgdown:
|
11 |
| - runs-on: macOS-latest |
| 16 | + runs-on: ubuntu-latest |
| 17 | + # Only restrict concurrency for non-PR jobs |
| 18 | + concurrency: |
| 19 | + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} |
12 | 20 | env:
|
13 | 21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
| 22 | + permissions: |
| 23 | + contents: write |
14 | 24 | steps:
|
15 |
| - - uses: actions/checkout@v2 |
| 25 | + - uses: actions/checkout@v3 |
16 | 26 |
|
17 |
| - - uses: r-lib/actions/setup-r@v1 |
| 27 | + - uses: r-lib/actions/setup-pandoc@v2 |
18 | 28 |
|
19 |
| - - uses: r-lib/actions/setup-pandoc@v1 |
20 |
| - |
21 |
| - - name: Query dependencies |
22 |
| - run: | |
23 |
| - install.packages('remotes') |
24 |
| - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) |
25 |
| - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") |
26 |
| - shell: Rscript {0} |
| 29 | + - uses: r-lib/actions/setup-r@v2 |
| 30 | + with: |
| 31 | + use-public-rspm: true |
27 | 32 |
|
28 |
| - - name: Cache R packages |
29 |
| - uses: actions/cache@v2 |
| 33 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
30 | 34 | with:
|
31 |
| - path: ${{ env.R_LIBS_USER }} |
32 |
| - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} |
33 |
| - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- |
| 35 | + extra-packages: any::pkgdown, local::. |
| 36 | + needs: website |
34 | 37 |
|
35 |
| - - name: Install dependencies |
36 |
| - run: | |
37 |
| - remotes::install_deps(dependencies = TRUE) |
38 |
| - install.packages("pkgdown", type = "binary") |
| 38 | + - name: Build site |
| 39 | + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) |
39 | 40 | shell: Rscript {0}
|
40 | 41 |
|
41 |
| - - name: Install package |
42 |
| - run: R CMD INSTALL . |
43 |
| - |
44 |
| - - name: Deploy package |
45 |
| - run: | |
46 |
| - git config --local user.email "[email protected]" |
47 |
| - git config --local user.name "GitHub Actions" |
48 |
| - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' |
| 42 | + - name: Deploy to GitHub pages 🚀 |
| 43 | + if: github.event_name != 'pull_request' |
| 44 | + |
| 45 | + with: |
| 46 | + clean: false |
| 47 | + branch: gh-pages |
| 48 | + folder: docs |
0 commit comments