Cran #66
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| name: pkgdown | |
| # Sets permissions of the GITHUB_TOKEN | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| pull-requests: write | |
| actions: read | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: | | |
| any::pkgdown | |
| local::. | |
| needs: website | |
| - name: Build site | |
| run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
| shell: Rscript {0} | |
| # Upload artifact for GitHub Pages deployment (only for pushes to main/master) | |
| - name: Upload Pages artifact | |
| if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs | |
| # Upload artifact for PR preview (only for pull requests) | |
| - name: Upload PR artifact | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pkgdown-site | |
| path: docs | |
| # Post comment with link to artifact on PRs | |
| - name: Post artifact link to PR | |
| if: github.event_name == 'pull_request' | |
| uses: CDCgov/cfa-actions/post-artifact@v1.2.0 | |
| with: | |
| artifact-name: pkgdown-site | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} | |
| message: 'Thank you for your contribution @${{ github.actor }} :rocket:! The pkgdown site preview is ready for review :point_right: [Download here]({ artifact-url }) :point_left:!' | |
| # Deployment job - only runs on pushes to main/master | |
| deploy: | |
| if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |