|
| 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 | | - - master |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + workflow_dispatch: |
5 | 10 |
|
6 | | -name: pkgdown |
| 11 | +name: pkgdown.yaml |
| 12 | + |
| 13 | +permissions: read-all |
7 | 14 |
|
8 | 15 | jobs: |
9 | 16 | pkgdown: |
10 | 17 | 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 }} |
11 | 21 | env: |
12 | 22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + permissions: |
| 24 | + contents: write |
13 | 25 | steps: |
14 | | - - uses: actions/checkout@v2 |
| 26 | + - uses: actions/checkout@v4 |
15 | 27 |
|
16 | | - - uses: actions/setup-node@v2 |
17 | | - with: |
18 | | - node-version: '16' |
| 28 | + - uses: r-lib/actions/setup-pandoc@v2 |
19 | 29 |
|
20 | 30 | - uses: r-lib/actions/setup-r@v2 |
| 31 | + with: |
| 32 | + use-public-rspm: true |
21 | 33 |
|
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 |
23 | 38 |
|
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) |
29 | 41 | shell: Rscript {0} |
30 | 42 |
|
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 |
33 | 46 | 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