Skip to content

Instantly share code, notes, and snippets.

@mcanouil
Created March 18, 2026 19:35
Show Gist options
  • Select an option

  • Save mcanouil/e885c7c831a46060a4163f952e565ecf to your computer and use it in GitHub Desktop.

Select an option

Save mcanouil/e885c7c831a46060a4163f952e565ecf to your computer and use it in GitHub Desktop.
Workflow to deploy pkgdown website from action
name: pkgdown.yaml
on:
workflow_dispatch:
push:
branches:
- main
release:
types: [published]
permissions: read-all
jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Setup R dependencies
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(dest_dir = "docs", new_process = FALSE, install = FALSE)
shell: Rscript {0}
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v4
with:
path: "docs"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment