Skip to content

proper esacpe

proper esacpe #46

Workflow file for this run

# permissions and concurrency settings for GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
on:
push:
branches:
- 'master'
jobs:
build:
name: pkgup
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- name: cache-r-dependencies
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}/*
key: library-cache-${{ github.run_id }}
restore-keys: library-cache
- name: setup-r-dependencies
run: |
Rscript -e 'stopifnot(file.copy("DESCRIPTION", file.path(tdir<-tempdir(), "PACKAGES"))); db<-available.packages(paste0("file://", tdir)); deps<-setdiff(tools::package_dependencies(read.dcf("DESCRIPTION", fields="Package")[[1L]], db, which="most")[[1L]], installed.packages(priority="high")[,"Package"]); if (length(deps)) { ap<-available.packages()[,"Version"]; ap<-ap[names(ap) %in% deps]; if (!all(deps%in%names(ap))) stop("dependencies are not avaiable in repository: ",paste(setdiff(deps, names(ap)), collapse=", ")); ip<-installed.packages()[,"Version"]; ip<-ip[names(ip) %in% deps]; pkgs<-ap[deps]>ip[deps]; install.packages(names(pkgs[pkgs|is.na(pkgs)])) }'
- name: build
run: |
echo "Revision:" $GITHUB_SHA >> ./DESCRIPTION
R CMD build .
- name: check
run: |
R CMD check --as-cran --no-manual $(ls -1t pkgup_*.tar.gz | head -n 1)
- name: doc
if: github.ref == 'refs/heads/master'
run: |
mkdir -p .pkgup/doc/vignettes
echo -e 'output:\n litedown::html_format:\n options:\n toc:\n depth: 4\n litedown::latex_format:\n meta:\n documentclass: "book"\n\nbook:\n new_session: false\n subdir: true\n pattern: "[.]R?md$"\n chapter_before: "Information before a chapter."\n chapter_after: "This chapter was generated from `$input$`."' > .pkgup/doc/_litedown.yml
echo -e '---\nsite:\n rebuild: "outdated"\n pattern: "[.]R?md$"\n---\n\n```{r, echo=FALSE}\nlitedown::pkg_desc()\n```\n\nTo cite the package:\n\n```{r, echo=FALSE}\nlitedown::pkg_citation()\n```' > .pkgup/doc/index.Rmd
#Rscript -e 'litedown::pkg_manual()' > .pkgup/doc/manual.Rmd
echo -e '```{r, echo=FALSE}\nlitedown::pkg_manual()\n```' > .pkgup/doc/manual.Rmd
#Rscript -e 'litedown::pkg_news(recent=0)' > .pkgup/doc/news.Rmd
echo -e '```{r, echo=FALSE}\nlitedown::pkg_news(recent=0)\n```' > .pkgup/doc/news.Rmd
echo -e '```{r, echo=FALSE, results="asis"}\nrmd = list.files("./vignettes", "*.Rmd", full.names=TRUE)\nif (!length(rmd)) {\n cat("no vignettes\\n")\n} else {\n title = function(f) {\n title1 = function(f) {\n if (!file.exists(f))\n stop("file ", f, " does not exists")\n l = readLines(f)\n t = paste(head(strsplit(basename(f), ".", fixed=TRUE)[[1L]], -1L), collapse=".") ## default, basename without extension\n for (i in seq_along(l)) {\n if (substr(l[i], 1L, 6L) != \"title:\")\n next\n t = trimws(gsub("title:", "", l[i], fixed=TRUE))\n break\n }\n t\n }\n sapply(f, title1)\n }\n html = paste0(substr(rmd, 1L, nchar(rmd)-3L), "html")\n lapply(html, function(f) cat(sprintf("[%s](%s)\\n", title(rmd), f))) |> invisible()\n}\n```' > .pkgup/doc/vignettes.Rmd
cp -r vignettes/* .pkgup/doc/vignettes/
R CMD INSTALL $(ls -1t pkgup_*.tar.gz | head -n 1)
Rscript -e 'litedown::fuse_site(".pkgup/doc")'
ls -aR .pkgup/doc
- name: repo
if: github.ref == 'refs/heads/master'
run: |
mkdir -p .pkgup/repo/src/contrib
mv "$(ls -1t pkgup_*.tar.gz | head -n 1)" .pkgup/repo/src/contrib
Rscript -e 'tools::write_PACKAGES(".pkgup/repo/src/contrib", fields="Revision")'
#ls -aR .pkgup/repo
- name: public
if: github.ref == 'refs/heads/master'
run: |
mkdir -p public
cp -r .pkgup/repo/* public
rsync -ravz --include '*/' --include='*.html' --exclude='*' .pkgup/doc/ public/
#ls -aR public
- name: upload
if: github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v1
with:
path: "public"
- name: deploy
if: github.ref == 'refs/heads/master'
id: deployment
uses: actions/deploy-pages@v1