Christophe Dervieux | 7f1add5 | 2021-09-15 15:42:07 +0200 | [diff] [blame] | 1 | on: |
| 2 | push: |
| 3 | branches: [main, master] |
| 4 | tags: ['*'] |
| 5 | pull_request: |
| 6 | branches: [main, master] |
| 7 | name: pkgdown |
| 8 | |
| 9 | jobs: |
| 10 | pkgdown: |
| 11 | if: ${{ github.event_name == 'push' || startsWith(github.head_ref, 'pkgdown/') }} |
| 12 | runs-on: ubuntu-latest |
| 13 | env: |
| 14 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 15 | steps: |
| 16 | - uses: actions/checkout@v2 |
| 17 | |
| 18 | - uses: r-lib/actions/setup-pandoc@v1 |
| 19 | |
| 20 | - uses: r-lib/actions/setup-r@v1 |
| 21 | with: |
| 22 | use-public-rspm: true |
| 23 | |
| 24 | - uses: r-lib/actions/setup-r-dependencies@v1 |
| 25 | with: |
Christophe Dervieux | b227fd0 | 2021-09-15 16:20:27 +0200 | [diff] [blame] | 26 | extra-packages: r-lib/pkgdown, rstudio/quillt |
| 27 | # needs: website |
Christophe Dervieux | 7f1add5 | 2021-09-15 15:42:07 +0200 | [diff] [blame] | 28 | |
| 29 | - name: Install package |
| 30 | run: R CMD INSTALL . |
| 31 | |
| 32 | - name: Cache some pkgdown assets |
| 33 | uses: actions/cache@v2 |
| 34 | with: |
| 35 | path: | |
| 36 | vignettes/articles/images/*.png |
| 37 | key: 1-${{ hashFiles('vignettes/articles/examples.yml') }} |
| 38 | |
| 39 | - name: Build pkgdown site |
| 40 | run: pkgdown::build_site(new_process = FALSE) |
| 41 | shell: Rscript {0} |
| 42 | |
| 43 | - name: Deploy to Netlify |
christophe dervieux | 5f74c8a | 2021-09-15 15:45:25 +0200 | [diff] [blame] | 44 | if: ${{ false }} # TODO: setup netlify |
Christophe Dervieux | 7f1add5 | 2021-09-15 15:42:07 +0200 | [diff] [blame] | 45 | id: netlify-deploy |
| 46 | uses: nwtgck/actions-netlify@v1.1 |
| 47 | with: |
| 48 | publish-dir: 'reference' |
| 49 | # change back to master if branch is not correct |
| 50 | production-branch: main |
| 51 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | deploy-message: |
| 53 | 'Deploy from GHA: ${{ github.event.head_commit.message }} (${{ github.sha }})' |
| 54 | enable-pull-request-comment: false |
| 55 | enable-commit-comment: false |
| 56 | enable-commit-status: true |
| 57 | alias: deploy-preview-${{ github.event.number }} |
| 58 | env: |
| 59 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 60 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |