|
| 1 | +on: |
| 2 | + issue_comment: |
| 3 | + types: [created] |
| 4 | + |
| 5 | +name: doc-preview.yaml |
| 6 | + |
| 7 | +permissions: read-all |
| 8 | + |
| 9 | +jobs: |
| 10 | + preview: |
| 11 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'CONTRIBUTOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/preview-docs') }} |
| 12 | + |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + # Needed to write a comment on the PR |
| 16 | + pull-requests: write |
| 17 | + # Needed to read the PR branch |
| 18 | + contents: read |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + # Checkout the PR branch |
| 23 | + ref: refs/pull/${{ github.event.issue.number }}/head |
| 24 | + |
| 25 | + - uses: r-lib/actions/setup-pandoc@v2 |
| 26 | + |
| 27 | + - uses: r-lib/actions/setup-r@v2 |
| 28 | + with: |
| 29 | + use-public-rspm: true |
| 30 | + |
| 31 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
| 32 | + with: |
| 33 | + extra-packages: any::pkgdown, local::. |
| 34 | + needs: website |
| 35 | + |
| 36 | + - name: Build site |
| 37 | + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) |
| 38 | + shell: Rscript {0} |
| 39 | + |
| 40 | + - name: Deploy to Netlify |
| 41 | + |
| 42 | + with: |
| 43 | + # Standard config |
| 44 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + deploy-message: "Deploy from GitHub Actions" |
| 46 | + # 'docs/' is the default directory for pkgdown::build_site() |
| 47 | + # we add 'dev' because _pkgdown.yml has 'development: mode: devel' |
| 48 | + publish-dir: './docs/dev' |
| 49 | + # Development deploys only |
| 50 | + production-deploy: false |
| 51 | + # Enable pull request comment (default) |
| 52 | + enable-pull-request-comment: true |
| 53 | + # Overwrite the pull request comment with updated link (default) |
| 54 | + overwrites-pull-request-comment: true |
| 55 | + # Don't deploy to GitHub |
| 56 | + enable-github-deployment: false |
| 57 | + # Don't update the status of the commit |
| 58 | + enable-commit-status: false |
| 59 | + # Don't comment on the commit |
| 60 | + enable-commit-comment: false |
| 61 | + env: |
| 62 | + # Netlify credentials (currently from Dmitry's account) |
| 63 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 64 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 65 | + timeout-minutes: 1 |
0 commit comments