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: |
| 26 | needs: website |
| 27 | |
| 28 | - name: Install package |
| 29 | run: R CMD INSTALL . |
| 30 | |
| 31 | - name: Cache some pkgdown assets |
| 32 | uses: actions/cache@v2 |
| 33 | with: |
| 34 | path: | |
| 35 | vignettes/articles/images/*.png |
| 36 | key: 1-${{ hashFiles('vignettes/articles/examples.yml') }} |
| 37 | |
| 38 | - name: Build pkgdown site |
| 39 | run: pkgdown::build_site(new_process = FALSE) |
| 40 | shell: Rscript {0} |
| 41 | |
| 42 | - name: Deploy to Netlify |
| 43 | if: false() # TODO: setup netlify |
| 44 | id: netlify-deploy |
| 45 | uses: nwtgck/actions-netlify@v1.1 |
| 46 | with: |
| 47 | publish-dir: 'reference' |
| 48 | # change back to master if branch is not correct |
| 49 | production-branch: main |
| 50 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | deploy-message: |
| 52 | 'Deploy from GHA: ${{ github.event.head_commit.message }} (${{ github.sha }})' |
| 53 | enable-pull-request-comment: false |
| 54 | enable-commit-comment: false |
| 55 | enable-commit-status: true |
| 56 | alias: deploy-preview-${{ github.event.number }} |
| 57 | env: |
| 58 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 59 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |