|
| 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 |
| 3 | +# |
| 4 | +# Reproduce locally by running: |
| 5 | +# ```r |
| 6 | +# pak::pak(c("any::pkgdown", "."), dependencies = "Config/Needs/website") |
| 7 | +# pkgdown::build_site() |
| 8 | +# ``` |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [main, master] |
| 12 | + paths: |
| 13 | + - 'README.Rmd' |
| 14 | + - 'README.md' |
| 15 | + - 'index.Rmd' |
| 16 | + - 'index.md' |
| 17 | + - 'man/**' |
| 18 | + - 'vignettes/**' |
| 19 | + - '_pkgdown.yml' |
| 20 | + - 'pkgdown/**' |
| 21 | + - 'DESCRIPTION' |
| 22 | + - '.Rbuildignore' |
| 23 | + - '.github/**' |
| 24 | + merge_group: |
| 25 | + pull_request: |
| 26 | + paths: |
| 27 | + - 'README.Rmd' |
| 28 | + - 'README.md' |
| 29 | + - 'index.Rmd' |
| 30 | + - 'index.md' |
| 31 | + - 'man/**' |
| 32 | + - 'vignettes/**' |
| 33 | + - '_pkgdown.yml' |
| 34 | + - 'pkgdown/**' |
| 35 | + - 'DESCRIPTION' |
| 36 | + - '.Rbuildignore' |
| 37 | + - '.github/**' |
| 38 | + release: |
| 39 | + types: [published] |
| 40 | + workflow_dispatch: |
| 41 | + |
| 42 | +name: pkgdown |
| 43 | + |
| 44 | +concurrency: |
| 45 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 46 | + cancel-in-progress: true |
| 47 | + |
| 48 | +permissions: |
| 49 | + contents: write |
| 50 | + |
| 51 | +jobs: |
| 52 | + pkgdown: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + env: |
| 55 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - uses: r-lib/actions/setup-pandoc@v2 |
| 60 | + |
| 61 | + - uses: r-lib/actions/setup-r@v2 |
| 62 | + with: |
| 63 | + use-public-rspm: true |
| 64 | + |
| 65 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
| 66 | + with: |
| 67 | + extra-packages: any::pkgdown, local::. |
| 68 | + needs: website |
| 69 | + |
| 70 | + - name: Build site |
| 71 | + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) |
| 72 | + shell: Rscript {0} |
| 73 | + |
| 74 | + - name: Check website links |
| 75 | + uses: untitaker/hyperlink@0.1.44 |
| 76 | + with: |
| 77 | + args: docs/ |
| 78 | + |
| 79 | + - name: Deploy to GitHub pages 🚀 |
| 80 | + if: github.event_name != 'merge_group' && github.event_name != 'pull_request' |
| 81 | + uses: JamesIves/github-pages-deploy-action@v4.7.3 |
| 82 | + with: |
| 83 | + # We clean on releases because we want to remove old vignettes, |
| 84 | + # figures, etc. that have been deleted from the `main` branch. |
| 85 | + # But we clean ONLY on releases because we want to be able to keep |
| 86 | + # both the 'stable' and 'dev' websites. |
| 87 | + # Also discussed in https://github.com/r-lib/actions/issues/484 |
| 88 | + clean: ${{ github.event_name == 'release' }} |
| 89 | + branch: gh-pages |
| 90 | + folder: docs |
0 commit comments