From 658bc0c7f66d5865a713dcf3b46dcf380ee759db Mon Sep 17 00:00:00 2001 From: Dan Snow Date: Fri, 14 Jul 2023 13:20:09 -0500 Subject: [PATCH] Update pkgdown Actions workflow --- .github/workflows/pkgdown.yaml | 40 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index e9dd857..59ff4be 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,5 +1,3 @@ -# 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: workflow_dispatch: pull_request: @@ -14,32 +12,25 @@ jobs: uses: ./.github/workflows/prepare-ptaxsim.yaml secrets: inherit - pkgdown: + build-pkgdown-site: needs: prepare-ptaxsim runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} PTAXSIM_DB_PATH: ${{ github.workspace }}/ptaxsim.db - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} - cancel-in-progress: false - permissions: - contents: read - pages: write - id-token: write steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v2 + - name: Setup pandoc + uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::pkgdown, local::. needs: website @@ -57,7 +48,7 @@ jobs: pbzip2 -d ptaxsim.db.bz2 shell: bash - - name: Build site + - name: Build pkgdown site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} @@ -69,6 +60,17 @@ jobs: with: path: 'docs' + deploy: + if: contains(fromJSON('["main", "master"]'), github.ref_name) && github.event_name != 'pull_request' + needs: build-pkgdown-site + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + pages: write + id-token: write + steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2