increase nudge #138
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
# Automatically rebuilds pkgdown website any time master branch is updated. | |
# Also builds pkgdown on "gh-pages-test" on commits to pull requests. | |
# Based on <https://github.com/r-lib/actions/blob/master/examples/pkgdown.yaml>. | |
# Conditional based on <https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables>. | |
on: | |
push: | |
branches: master | |
pull_request: | |
name: pkgdown | |
jobs: | |
pkgdown: | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Checkout CMAP fonts repo | |
uses: actions/checkout@v3 | |
with: | |
repository: CMAP-REPOS/cmap-fonts | |
token: ${{ secrets.CMAP_REPO_FULL_ACCESS }} | |
path: cmap-fonts | |
- name: Install CMAP fonts for R access | |
# Inspiration: https://gist.github.com/Kevin-Lee/328e9993d6b3ad250636023fb2c7827f | |
run: | | |
repo_dir="$GITHUB_WORKSPACE/cmap-fonts" | |
font_dir="$HOME/Library/Fonts" | |
mkdir -p $font_dir | |
find_command="find \"$repo_dir\" -name '*.[o,t]tf' -type f -print0" | |
eval $find_command | xargs -0 -I % | |
eval $find_command | xargs -0 -I % cp "%" "$font_dir/" | |
find "$font_dir" -name '*.[o,t]tf' -print0 | xargs -0 -I % | |
- name: Query dependencies | |
run: | | |
install.packages('remotes') | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
shell: Rscript {0} | |
- name: Cache R packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Install dependencies | |
run: | | |
remotes::install_deps(dependencies = TRUE) | |
install.packages("pkgdown") | |
shell: Rscript {0} | |
- name: Check Whitney availability in R | |
run: | | |
all_fonts <- systemfonts::system_fonts() | |
message("WHITNEY FONTS AUTOMATICALLY AVAILABLE TO SYSTEMFONTS:") | |
message(paste(all_fonts$name[grepl("^Whitney", all_fonts$name)], collapse = "\n")) | |
user_dir <- paste0(Sys.getenv("HOME"), "/Library/Fonts") | |
library_fonts <- list.files(user_dir) | |
message(paste0("WHITNEY FONTS IN ", user_dir, " (MUST BE REGISTERED):")) | |
message(paste(library_fonts[grepl("^Whitney", library_fonts)], collapse = "\n")) | |
shell: Rscript {0} | |
- name: Install package | |
run: R CMD INSTALL . | |
- name: Deploy package to live branch | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
echo "This is $GITHUB_REF. Deploying to gh-pages branch." | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
Rscript -e 'pkgdown::deploy_to_branch(clean = TRUE)' | |
- name: Deploy package to test branch | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: | | |
echo "This is $GITHUB_REF. Deploying to gh-pages-test branch." | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
Rscript -e 'pkgdown::deploy_to_branch(branch="gh-pages-test", clean = TRUE)' |