-
Notifications
You must be signed in to change notification settings - Fork 226
Create a workflow to render website with Rmarkdown #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It is challenging to maintain a lot of workflows that are untested or lightly tested. Nevertheless, I would be happy to review a PR for such a workflow. I think it will be very close to https://github.com/r-lib/actions/blob/v2-branch/examples/bookdown.yaml or the other bookdown workflow, but instead of calling I would probably use pak instead of renv for a new workflow, but YMMV. |
Thank you for your feedback, it's much appreciated. Indeed, I have a workflow very similar to https://github.com/r-lib/actions/blob/v2-branch/examples/bookdown.yaml. # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples/blogdown.yaml
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
name: render_site.yaml
permissions: read-all
jobs:
renderrmarkdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: renderrmarkdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-renv@v2
- name: Build site
run: rmarkdown::render_site()
shell: Rscript {0}
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs But unfortunately I have a problem (with Pandoc) when I build the site with github actions. My issue :
I can build the site locally without any problem (using sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.utf8 LC_CTYPE=French_France.utf8 LC_MONETARY=French_France.utf8 LC_NUMERIC=C
[5] LC_TIME=French_France.utf8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] yaml_2.3.8 shiny_1.8.1.1 htmltools_0.5.8.1 gfonts_0.2.0 particlesjs_0.1.1 shufflecards_0.0.4
[7] jsonlite_1.8.8 httr_1.4.7 gh_1.4.1 formattable_0.2.1 flexdashboard_0.6.2
loaded via a namespace (and not attached):
[1] xfun_0.43 httr2_1.0.1 bslib_0.7.0 purrr_1.0.2 colorspace_2.1-0 vctrs_0.6.5
[7] utf8_1.2.4 rlang_1.1.4 jquerylib_0.1.4 pillar_1.9.0 later_1.3.2 httpcode_0.3.0
[13] glue_1.7.0 rappdirs_0.3.3 uuid_1.2-0 lifecycle_1.0.4 munsell_0.5.1 gtable_0.3.5
[19] fontawesome_0.5.2 htmlwidgets_1.6.4 memoise_2.0.1 evaluate_0.23 knitr_1.46 fastmap_1.1.1
[25] httpuv_1.6.15 crosstalk_1.2.1 curl_6.1.0 fansi_1.0.6 ggiraph_0.8.12 Rcpp_1.0.12
[31] xtable_1.8-4 renv_1.0.11 scales_1.3.0 promises_1.3.0 cachem_1.0.8 mime_0.12
[37] systemfonts_1.0.6 ggplot2_3.5.1 digest_0.6.35 grid_4.2.2 cli_3.6.2 tools_4.2.2
[43] magrittr_2.0.3 sass_0.4.9 tibble_3.2.1 crul_1.4.2 crayon_1.5.2 pkgconfig_2.0.3
[49] rmarkdown_2.29 rstudioapi_0.16.0 R6_2.5.1 gitcreds_0.1.2 compiler_4.2.2 I think that for this to work, I'd turn my project into a package and use In any case, I publish my static site from the /docs master but it's not satisfactory. Thanks for your feedback! |
This is coming from your code in the Rmd, so I suggest you try something very simple first, just to get the tooling right, and then use the full Rmd. It might be easier to debug this interactively, one action that can help you with that is https://github.com/r-hub/actions/tree/main/debug-shell |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I'd like to create a static page or web site from an R project.
Currently I have a project that I started with Rstudio (New Projet->Create a simple R Markdown website).
My problem is that I'm forced to push my site on my github repos for the moment (the site is in docs/ and github deploits correctly from docs/ on master).
Is it possible with git to push on a gh-pages branch only the content of the site (the content of “_site” by default or docs/ for me)?
This would allow me to have a repository with the source code only.
Another question, I haven't tried it yet but I'd like to create a CI/CD that performs a
rmarkdown::render_site()
and deploys on gh-pages a bit likeusethis::use_github_action(“pkgdown”)
.Is this possible?
If you have any info on best practices with Rmarkdown simple website for optimal deployment, I'd love to hear from you.
I'll have a solution if what I'm asking for isn't suitable or intended for this. I can also transform my R project into a package and simply use
{pkgdown}
and deploy withusethis::use_github_action(“pkgdown”)
.Thanks a lot!
The text was updated successfully, but these errors were encountered: