|
1 | 1 | on:
|
2 | 2 | push:
|
3 | 3 | branches:
|
| 4 | + - master |
4 | 5 | - main
|
| 6 | + pull_request: |
| 7 | + branches: |
5 | 8 | - master
|
6 |
| - tags: |
7 |
| - -'*' |
| 9 | + - main |
8 | 10 |
|
9 | 11 | name: pkgdown
|
10 | 12 |
|
11 | 13 | jobs:
|
12 | 14 | pkgdown:
|
13 |
| - runs-on: ubuntu-18.04 |
| 15 | + runs-on: macOS-latest |
14 | 16 | env:
|
15 |
| - RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest |
16 | 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
17 |
| - |
18 | 18 | steps:
|
19 | 19 | - uses: actions/checkout@v2
|
20 | 20 |
|
21 | 21 | - uses: r-lib/actions/setup-r@v1
|
22 |
| - id: install-r |
23 | 22 |
|
24 | 23 | - uses: r-lib/actions/setup-pandoc@v1
|
25 | 24 |
|
| 25 | + - name: System dependencies |
| 26 | + run: brew install harfbuzz fribidi |
| 27 | + |
26 | 28 | - name: Install pak and query dependencies
|
27 | 29 | run: |
|
28 | 30 | install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
|
29 | 31 | saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
|
30 | 32 | shell: Rscript {0}
|
31 | 33 |
|
32 |
| - - name: Restore R package cache |
| 34 | + - name: Cache R packages |
33 | 35 | uses: actions/cache@v2
|
34 | 36 | with:
|
35 |
| - path: | |
36 |
| - ${{ env.R_LIBS_USER }}/* |
37 |
| - !${{ env.R_LIBS_USER }}/pak |
38 |
| - key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} |
39 |
| - restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1- |
| 37 | + path: ${{ env.R_LIBS_USER }} |
| 38 | + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/r-depends.rds') }} |
| 39 | + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- |
40 | 40 |
|
41 | 41 | - name: Install system dependencies
|
42 |
| - if: runner.os == 'Linux' |
43 | 42 | run: |
|
44 | 43 | pak::local_system_requirements(execute = TRUE)
|
45 | 44 | pak::pkg_system_requirements("pkgdown", execute = TRUE)
|
|
53 | 52 | pak::pkg_install("pkgdown")
|
54 | 53 | shell: Rscript {0}
|
55 | 54 |
|
56 |
| - |
57 | 55 | - name: Install Miniconda
|
58 | 56 | run: |
|
59 | 57 | Rscript -e "pak::pkg_install('rstudio/reticulate')"
|
|
72 | 70 | - name: Install package
|
73 | 71 | run: R CMD INSTALL .
|
74 | 72 |
|
75 |
| - - name: Build and deploy pkgdown site |
| 73 | + - name: Build site |
| 74 | + if: github.ref != 'refs/heads/master' |
| 75 | + run: | |
| 76 | + Rscript -e 'pkgdown::build_site()' |
| 77 | +
|
| 78 | + - name: Deploy package |
| 79 | + if: github.ref == 'refs/heads/master' |
76 | 80 | run: |
|
77 |
| - git config --local user.name "$GITHUB_ACTOR" |
78 |
| - git config --local user.email "[email protected]" |
| 81 | + git config --local user.email "[email protected]" |
| 82 | + git config --local user.name "GitHub Actions" |
79 | 83 | Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
|
0 commit comments