如何修复pkgdown+GitLab CI/CD流程中的R包首页渲染问题?
问题:GitLab CI/CD构建pkgdown站点时未加载README内容作为首页
本地执行build_site()时,生成的pkgdown站点符合预期,会使用编织README.Rmd得到的README.md作为首页。但在GitLab的CI/CD流水线中构建站点时,首页仅基于DESCRIPTION文件生成极简内容,只显示一行包描述文本,README内容未被加载(函数文档显示正常)。
流水线脚本
image: rocker/tidyverse stages: # List of stages for jobs, and their order of execution - build - test - deploy build-job: # This job runs in the build stage, which runs first. tags: - [runner name] stage: build script: - /bin/bash - echo "no build" unit-test-job: # This job runs in the test stage. tags: - [runner name] stage: test # It only starts when the job in the build stage completes successfully. script: - /bin/bash - echo "no unit tests" pages: # This job runs in the deploy stage. tags: - docker stage: deploy # It only runs when *both* jobs in the test stage complete successfully. environment: production script: - R -e 'install.packages(c("devtools", "pkgdown"))' - R -e 'devtools::install()' - R -e 'pkgdown::build_site()' artifacts: paths: - public
相关参考内容(《R Packages(第2版)》)
首页
首页(index.html)的主要内容按优先级从pkgdown/index.md、index.md到README.md生成。大多数包使用README.md,因为它也会在GitHub和CRAN上显示。若希望包网站与README外观不同,可使用index.md;若不想将文件放在包根目录,可使用pkgdown/index.md。若使用index.Rmd或README.Rmd,需自行编织文档生成对应的.md文件。pkgdown不会代劳,因为它仅处理doc/目录下的文件。
内容的提问来源于stack exchange,提问作者Arthur
相关产品推荐
相关产品推荐

