From c52e0433818c1337f33afdbd422843b0451dd418 Mon Sep 17 00:00:00 2001 From: James Azam Date: Tue, 18 Jul 2023 17:37:53 +0100 Subject: [PATCH] Added the packagetemplete pkgdown workflows --- .github/workflows/pkgdown.yaml | 49 +++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 087f0b05..9c32a3dd 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,24 +1,56 @@ # 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 +# +# Reproduce locally by running: +# ```r +# pak::pak(c("any::pkgdown", "."), dependencies = "Config/Needs/website") +# pkgdown::build_site() +# ``` on: push: branches: [main, master] + paths: + - 'README.Rmd' + - 'README.md' + - 'index.Rmd' + - 'index.md' + - 'man/**' + - 'vignettes/**' + - '_pkgdown.yml' + - 'pkgdown/**' + - 'DESCRIPTION' + - '.Rbuildignore' + - '.github/**' pull_request: - branches: [main, master] + paths: + - 'README.Rmd' + - 'README.md' + - 'index.Rmd' + - 'index.md' + - 'man/**' + - 'vignettes/**' + - '_pkgdown.yml' + - 'pkgdown/**' + - 'DESCRIPTION' + - '.Rbuildignore' + - '.github/**' release: types: [published] workflow_dispatch: name: pkgdown +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: pkgdown: runs-on: ubuntu-latest - # Only restrict concurrency for non-PR jobs - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - uses: actions/checkout@v3 @@ -39,8 +71,13 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.4.1 + uses: JamesIves/github-pages-deploy-action@4.1.4 with: - clean: false + # We clean on releases because we want to remove old vignettes, + # figures, etc. that have been deleted from the `main` branch. + # But we clean ONLY on releases because we want to be able to keep + # both the 'stable' and 'dev' websites. + # Also discussed in https://github.com/r-lib/actions/issues/484 + clean: ${{ github.event_name == 'release' }} branch: gh-pages folder: docs