Fix issue when no nightly was installed, but the installed folder exi… #160
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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
release: | |
types: [published] | |
workflow_dispatch: | |
name: pkgdown | |
jobs: | |
pkgdown: | |
runs-on: ubuntu-latest | |
# Only restrict concurrency for non-PR jobs | |
concurrency: | |
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::pkgdown, local::. | |
needs: website | |
- name: Gets Pandoc installed folder | |
id: pandoc-install-dir | |
run: cat("::set-output name=path::", normalizePath(pandoc:::pandoc_home(), "/", FALSE), "\n", sep = "") | |
shell: Rscript {0} | |
- name: Cache Pandoc installed versions | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pandoc-install-dir.outputs.path}} | |
key: ${{github.workflow}}-1-${{ runner.os }}-${{runner.arch}}- | |
- name: Get last release version to cache fetched information | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: pandoc-release | |
run: | | |
echo "::set-output name=version::$(gh release view -R jgm/pandoc --json tagName -q .tagName)" | |
shell: bash | |
- name: Cache Pandoc release information | |
uses: actions/cache@v2 | |
id: cache-release | |
with: | |
path: github-cache.rds | |
key: gh-info-${{ steps.pandoc-release.outputs.version}}-1 | |
- run: ls -lisa | |
shell: bash | |
- name: Fetch new release info from github | |
if: steps.cache-release.outputs.cache-hit != 'true' | |
run: saveRDS(pandoc:::fetch_gh_releases(), "github-cache.rds", version = 2) | |
shell: Rscript {0} | |
- name: Build site | |
env: | |
# Use a cached version of API request | |
PANDOC_CACHE_GITHUB: ${{ github.workspace }}/github-cache.rds | |
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
shell: Rscript {0} | |
- name: Deploy to GitHub pages 🚀 | |
if: github.event_name != 'pull_request' | |
uses: JamesIves/[email protected] | |
with: | |
clean: false | |
branch: gh-pages | |
folder: docs |