hack litedown #35
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
- 'litedown' | |
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: website | |
if: github.ref == 'refs/heads/litedown' | |
run: | | |
R CMD INSTALL $(ls -1t pkgup_*.tar.gz | head -n 1) ## seems to be required | |
ls vignettes/*.Rmd | |
ls vignettes/*.html 2> /dev/null | |
ls pkgup/*.Rmd | |
ls pkgup/*.html 2> /dev/null | |
Rscript -e 'reorder_input2 = function(x) {i = is_index(x); index = x[i][which.min(nchar(x[i]))]; c(index, rev(setdiff(x, index)))}; environment(reorder_input2) <- asNamespace("litedown"); assignInNamespace("reorder_input", reorder_input2, ns="litedown"); litedown::fuse_site("pkgup")' | |
mkdir -p public | |
find pkgup -name '*.html' -print0 | cpio -pvdmB --null public | |
ls -R public | |
mv public/pkgup/* public | |
rm -r public/pkgup | |
- name: repo | |
if: github.ref == 'refs/heads/litedown' | |
run: | | |
mkdir -p public/src/contrib | |
mv $(ls -1t pkgup_*.tar.gz | head -n 1) public/src/contrib | |
Rscript -e 'tools::write_PACKAGES("public/src/contrib", fields="Revision")' | |
- name: upload | |
if: github.ref == 'refs/heads/litedown' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "public" | |
- name: deploy | |
if: github.ref == 'refs/heads/litedown' | |
id: deployment | |
uses: actions/deploy-pages@v1 |