From fe4dc67258450c7e183e8e2cb19c1a6bc2b79785 Mon Sep 17 00:00:00 2001 From: Lewin Appleton-Fox Date: Thu, 6 May 2021 10:03:08 +1200 Subject: [PATCH] Add pkgdown GitHub action --- .Rbuildignore | 3 +++ .github/workflows/pkgdown.yml | 48 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 52 insertions(+) create mode 100644 .github/workflows/pkgdown.yml diff --git a/.Rbuildignore b/.Rbuildignore index f9266b7..9aa7db6 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,6 @@ ^\.Rproj\.user$ ^README\.Rmd$ ^LICENSE\.md$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml new file mode 100644 index 0000000..4cdf61a --- /dev/null +++ b/.github/workflows/pkgdown.yml @@ -0,0 +1,48 @@ +on: + push: + branches: + - main + - 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@v1 + + - uses: r-lib/actions/setup-pandoc@v1 + + - 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: Restore R package cache + uses: actions/cache@v2 + 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", type = "binary") + shell: Rscript {0} + + - name: Install package + run: R CMD INSTALL . + + - name: Deploy package + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5b6a065..234f028 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .Rhistory .RData .Ruserdata +docs