| # Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |||||
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |||||
| on: | on: | ||||
| push: | push: | ||||
| branches: | |||||
| - main | |||||
| - rc-** | |||||
| - docs/** | |||||
| pull_request: | |||||
| branches: | |||||
| - main | |||||
| branches: [main, master] | |||||
| tags: ['*'] | |||||
| name: pkgdown | name: pkgdown | ||||
| jobs: | jobs: | ||||
| pkgdown: | pkgdown: | ||||
| runs-on: ubuntu-18.04 | |||||
| runs-on: ubuntu-latest | |||||
| env: | env: | ||||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||||
| steps: | steps: | ||||
| - uses: actions/checkout@v2 | - uses: actions/checkout@v2 | ||||
| - uses: r-lib/actions/setup-pandoc@v1 | |||||
| - uses: r-lib/actions/setup-r@v1 | - uses: r-lib/actions/setup-r@v1 | ||||
| id: install-r | |||||
| with: | with: | ||||
| use-public-rspm: true | use-public-rspm: true | ||||
| - uses: r-lib/actions/setup-pandoc@v1 | |||||
| - uses: r-lib/actions/setup-r-dependencies@v1 | - uses: r-lib/actions/setup-r-dependencies@v1 | ||||
| with: | with: | ||||
| extra-packages: pkgdown | |||||
| needs: website | needs: website | ||||
| - name: Build Site | |||||
| shell: Rscript {0} | |||||
| - name: Deploy package | |||||
| run: | | run: | | ||||
| pkgdown::build_site(new_process = FALSE) | |||||
| - name: Set environment variable $GIT_BRANCH_NAME | |||||
| id: git-branch-name | |||||
| uses: EthanSK/git-branch-name-action@v1 | |||||
| - name: Deploy to Netlify | |||||
| if: github.event_name == 'push' | |||||
| id: netlify-deploy | |||||
| uses: nwtgck/actions-netlify@v1.1 | |||||
| with: | |||||
| publish-dir: 'reference' | |||||
| production-branch: main | |||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | |||||
| deploy-message: | |||||
| 'Deploy from GHA: ${{ github.event.head_commit.message }} (${{ github.sha }})' | |||||
| enable-pull-request-comment: false | |||||
| enable-commit-comment: false | |||||
| enable-commit-status: true | |||||
| alias: deploy-preview-${{ env.GIT_BRANCH_NAME }} | |||||
| env: | |||||
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |||||
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |||||
| git config --local user.name "$GITHUB_ACTOR" | |||||
| git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |||||
| Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' |