Skip to content

Merge pull request #22 from Sweetdevil144/master #53

Merge pull request #22 from Sweetdevil144/master

Merge pull request #22 from Sweetdevil144/master #53

Workflow file for this run

on:
push:
branches: master
pull_request:
branches: master
name: pkgdown
jobs:
pkgdown:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
shell: Rscript {0}
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")
- name: Cache R packages
uses: actions/cache@v1
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
shell: Rscript {0}
run: |
install.packages("remotes")
remotes::install_deps(dependencies = TRUE)
remotes::install_dev("pkgdown")
- name: Install package
run: R CMD INSTALL .
- name: Build Site (PR)
if: github.event_name != 'push'
shell: Rscript {0}
run: |
pkgdown::build_site(new_process = FALSE)
# Must validate after. Otherwise files are saved and `pkgdown::build_site()` gets mad
- name: Validate all topics exist (PR)
if: github.event_name != 'push'
shell: Rscript {0}
run: |
pkgdown::build_reference_index()
stopifnot(length(warnings()) == 0)
- name: Git Config
if: github.event_name == 'push'
run: |
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
git config --local user.name "${GITHUB_ACTOR}"
- name: Build and Deploy Site
if: github.event_name == 'push'
shell: Rscript {0}
run: |
pkgdown::deploy_to_branch(new_process = FALSE)