Skip to content

Adding pkgdown site built by GHA - #511

Merged
cderv merged 38 commits into
rstudio:masterfrom
apreshill:pkgdown-quillt
Feb 25, 2021
Merged

cderv merged 38 commits into
rstudio:masterfrom
apreshill:pkgdown-quillt

Conversation

@apreshill

@apreshill apreshill commented Nov 19, 2020 •

Copy link
Copy Markdown
Contributor

Leaving as a draft for now while we finalize the pkgdown template design (cc @cderv)

This site currently publishes to: https://pkgs.rstudio.com/blogdown/

The site is in the RStudio Netlify org.

To do before merging:

  1. Finalize pkgdown template (adding book to homepage, add examples, group reference page)

  2. Change the branch to deploy from in the GH action to master

  3. Add 2 secrets (NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID) to this repo. I don't have admin access to add myself.

  4. Add a code of conduct (required by Netlify's open source policy)

Note: we currently depend on the dev version of pkgdown to render NEWS.md correctly.

@cderv

cderv commented Feb 19, 2021

Copy link
Copy Markdown
Collaborator

I did the main part of it for this one. I think apart from the generic pieces to fill (CoC, netlify env var, branches, ...) there is only the example page which is still missing.

@apreshill you can have a wording review as for bookdown one. And maybe also the grouping for the references.
Passing the ball to you.

@cderv

cderv commented Feb 22, 2021

Copy link
Copy Markdown
Collaborator

@apreshill as discussed last Friday, I have now added examples of some blogdown websites in the community. I got some link from the rbind organization. See https://pkgs.rstudio.com/blogdown/articles/articles/examples.html for the result.

It is easy now to add new url and source, then takes screenshot and generate the YAML for integration. Feel free to provide other examples, I can rebuild easily. thanks!

usethis::use_code_of_conduct(".github") + tweaks
This reverts commit 58f98ca.
PR has been merged in quillt

@yihui yihui left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is easy now to add new url and source, then takes screenshot and generate the YAML for integration.

Genius! You did something that I wanted to do a few years ago: rbind/support#38. My only request for this PR is to cache the screenshots on GHA instead of storing the images in the repo, since they are relatively big and the list of websites may grow in the future (we don't want to store megabytes of screenshots in GIT when they can be dynamically generated).

I have added the secret env vars. Thanks!

@cderv

cderv commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator

Currently the chunks are with eval = FALSE so it is generated manually. I could leave the scraping a manual task and separate the snapshoting but this would require having chromium / chrome available in GHA environment to work in headless mode. I will check that.

About the caching, it can be at least on a cache key based on YAML file change. If a new YAML is pushed, then we would re-screenshot.

@cderv

cderv commented Feb 24, 2021 •

Copy link
Copy Markdown
Collaborator

@yihui it seems to work fine.

  • I remove the images from the repo (no more in this PR) and added a gitignore to avoid having them pushed if rendered locally
  • The webshot-ing has been separated - Chrome is already available on the runnners so that is great ! I needed to install explicitly in the GHA workflow optipng though.
  • Images are cached based on examples.yml - it means if we modify this file, every snapshot will be redone. If this file is not modify, the png would be download from cache and the chunk will not webshot() if image exist.
  • This required to add the webshot2 dependency to install explicitly in the GHA workflow.

Since remotes 2.2 there is a new way to specify extra dependencies in DESCRIPTION:

Remotes functions can now install dependencies from additional DESCRIPTION fields, e.g. passing dependencies = "Config/Needs/website" will install the dependencies listed in the Config/Needs/website: field in the package's DESCRIPTION. Prefixing fields with Config/Needs allows them to pass R CMD check without a NOTE, so it is the recommended format for these extra dependencies.

This is also supported by pkgdepends used by pak.

I find it a nice way to have all dependencies contained in DESCRIPTION without needing to add to Suggests for a pkgdown website or for book for example. Just sharing this for future usage maybe.

@cderv
cderv marked this pull request as ready for review February 24, 2021 19:38
Comment thread .github/workflows/pkgdown.yaml Outdated

- name: Deploy to Netlify
# only deploy on the fork for now
if: github.repository_owner == 'apreshill'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO change before merge

@cderv

cderv commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator

@apreshill is this ready to merge for you ? Seems ok to me.

Secrets are set and the correct contact email for CoC should be added once confirmed - we can do it later.
I noted you wanted to improve the reference page grouping for functions - we can also add it to the improvement list as it requires a bit of refactoring in the R files.

I recall you wanted to rewrite the Get Started article maybe - is it still the case ?

Thanks.

@apreshill

Copy link
Copy Markdown
Contributor Author

I'm fine with it as is! I'd love to reorg the reference page- some of the Hugo functions cannot be separated because of hugo.R, but it would be great to be able to separate the shortcodes for example from the new_* functions. Happy to put those on the improvements list!

@cderv
cderv merged commit 470a5f9 into rstudio:master Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants