Nonprofit-Open-Data-Collective / governance

R package for creating a governance quality index for nonprofits using 990 efile data.
https://nonprofit-open-data-collective.github.io/governance/
2 stars 0 forks source link

Method to Initialize GitHub Pages #1

Closed olbeck closed 2 weeks ago

olbeck commented 8 months ago

These are the steps I used to initialize the pkgdown, the have the website be built from main/doc (not default "git-pages" brach).

  1. Initialize Package in R - https://usethis.r-lib.org/reference/use_github_pages.html
library(usethis)
path <- file.path(tempdir(), "mypkg")
create_package(path)
  1. Initialize pkgdown in R https://pkgdown.r-lib.org/articles/pkgdown.html#configuration
# Run once to configure package to use pkgdown
usethis::use_pkgdown()
# Run to build the website
pkgdown::build_site()

Do not use usethis::use_pkgdown_github_pages(). We do not want their defaults so we will do it manually.

DO NOT PUSH TO GITHUB YET

  1. Open repo on Github.com. Go to Settings> Pages > Build and Deployment. Under Branch, choose "main" then "/docs" Screenshot 2024-02-21 at 12 38 47 PM

At this point, when you push to GitHub, the site is active at username.github.io/packagename ( you can see the link in the settings>pages page), but the link is not active on your main github.com/username/packagename site. To do that, open the website github.com/username/packagename, on the "About" section click the gear icon, then check the "Use your GitHub Pages website" box. Once you hit save, the package site link will appear on the repo main page.

Screenshot 2024-02-21 at 3 21 00 PM

This should be all you need to do initialize the GitHub pages website.

Everytime you update the funcitons in the package • Update documentation with devtools::document() (and do any other devtools updates you need to do) • Check package • Build package • Update website with pkgdown::build_site() • Push - After you push to GitHub, there will be an action to update the website, it will take a few minutes.

olbeck commented 2 weeks ago

There needs to be a step 2.1 here to ensure the docs folder gets pushed correctly and is being read by the yaml.

2.1 Some small checks

olbeck commented 2 weeks ago

fixed in docs/README.md