Skip to content

Commit

Permalink
fix pkgdown for both main and dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ygeunkim committed Jul 25, 2024
1 parent 9efdf42 commit aadbdd0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 11 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,26 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -42,19 +47,46 @@ jobs:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true


- name: Determine evaluate package version on Windows
if: runner.os == 'Windows'
run: |
if ($Env:MATRIX_CONFIG_R -lt "4.0.0") {
echo "EVALUATE_PKG=evaluate@0.23" >> $Env:GITHUB_ENV
} else {
echo "EVALUATE_PKG=evaluate" >> $Env:GITHUB_ENV
}
shell: pwsh

- name: Determine evaluate package version on non-Windows
if: runner.os != 'Windows'
run: |
if [ "${{ matrix.config.r }}" \< "4.0.0" ]; then
echo "EVALUATE_PKG=evaluate@0.23" >> $GITHUB_ENV
else
echo "EVALUATE_PKG=evaluate" >> $GITHUB_ENV
fi
shell: bash

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: any::rcmdcheck, ${{ env.EVALUATE_PKG }}
# extra-packages: >
# any::rcmdcheck,
# knitr=?ignore-before-r=4.0.0,
# rmarkdown=?ignore-before-r=4.0.0,
# testthat=?ignore-before-r=4.0.0
needs: check

# do not build vignettes in github actions check and ignore warnings
- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--no-build-vignettes", "--no-tests", "--no-examples")'
build_args: '"--no-build-vignettes"'
args: 'c("--no-manual", "--as-cran", "--no-vignettes", "--no-build-vignettes", "--ignore-vignettes", "--no-examples")'
build_args: 'c("--no-manual", "--no-build-vignettes")'
error-on: '"error"'
# upload-snapshots: true
check-dir: '"check"'
upload-snapshots: false
upload-results: false

# do not upload artifact until changing to public repo
# When public repo -> uncomment below
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, develop]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown
Expand Down Expand Up @@ -34,11 +32,26 @@ jobs:
with:
extra-packages: any::pkgdown, local::.
needs: website


- name: Choose between CRAN and dev
run: |
BRANCH=${GITHUB_REF##*/}
if [ "$BRANCH" == "develop" ]; then
sed -i 's|VERSION_TEXT|CRAN version|; s|VERSION_REF|https://ygeunkim.github.io/package/bvhar/|' _pkgdown.yml
else
sed -i 's|VERSION_TEXT|Development version|; s|VERSION_REF|https://ygeunkim.github.io/package/dev/bvhar/|' _pkgdown.yml
fi
shell: bash

- name: Build site
# run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
run: pkgdown::build_site()
shell: Rscript {0}

- name: Clean up existing worktree
run: |
git worktree prune
git worktree list
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
Expand All @@ -49,4 +62,5 @@ jobs:
clean: false
branch: master
folder: docs
target-folder: package/bvhar
# target-folder: package/bvhar
target-folder: ${{ github.ref == 'refs/heads/develop' && 'package/dev/bvhar' || 'package/bvhar' }}
6 changes: 6 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ template:
code-color: "#f8f8f2"
theme: github-dark

home:
links:
# see the configuration in .github/workflows/pkgdown.yaml
- text: VERSION_TEXT
href: VERSION_REF

development:
mode: auto

Expand Down

0 comments on commit aadbdd0

Please sign in to comment.