ci: Build docs in CI #23
Workflow file for this run
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
name: Build Docs | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main", "docs**"] | |
pull_request: | |
permissions: | |
contents: write | |
concurrency: | |
group: build-site-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || !startsWith(github.head_ref, 'docs') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 # jsdoc2md 4.0.1 doesn't work with node 23 | |
- name: Install dependencies | |
run: npm install | |
- name: Install pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install R Dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 2 | |
extra-packages: | | |
local::. | |
needs: | | |
website | |
- name: Render docs website | |
working-directory: docs | |
run: source build-site.sh | |
- name: Commit changes | |
run: | | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
git add docs/ && git commit -m "ci(docs): Automated site build" || echo "No doc changes" | |
git push || echo "No doc updates to push" |