github actions for R to automatically deploy a github-pages #156664
-
Select Topic AreaQuestion BodyHello, I want to know if there is a github action to deploy R documentation for a R package hosted on github automatically without resorting to making an entire site with R package pkgdown? I just want the documentation to be visible on my repository's main github site and to be rebuilt after every commit so that changes to the documentation are up to date. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hey! 👋 Yes, you can definitely set up a GitHub Action to deploy your R package documentation without needing to build a full site using If your goal is just to make the documentation (from
Here’s a minimal example of a GitHub Actions workflow that does exactly that: name: Build R Documentation
on:
push:
branches: [main]
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install dependencies
run: |
install.packages("roxygen2")
- name: Generate Rd files
run: |
Rscript -e "roxygen2::roxygenise()"
- name: Convert Rd to HTML
run: |
mkdir -p docs
Rscript -e "rd_files <- list.files('man', full.names = TRUE); lapply(rd_files, function(f) tools::Rd2HTML(f, out = file.path('docs', paste0(tools::file_path_sans_ext(basename(f)), '.html'))))"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docsJust make sure your repo is configured to publish GitHub Pages from the /docs folder on the main branch. Hope this helps! Let me know if you want to tweak this for your specific setup |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Hey! 👋 Yes, you can definitely set up a GitHub Action to deploy your R package documentation without needing to build a full site using
pkgdown.If your goal is just to make the documentation (from
man/*.Rdfiles) visible on your GitHub Pages site and keep it updated after every commit, you can:roxygen2to generate the.Rdfiles..Rdfiles to HTML using base R'stools::Rd2HTML().docs/folder on yourmainbranch).Here’s a minimal example of a GitHub Actions workflow that does exactly that: