Fix pkgdown build on GitHub Actions for new Ubuntu 24.04 runners #148
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
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [main, master] | |
push: | |
branches: [main, master] | |
name: pkgdown | |
jobs: | |
build-pkgdown-site: | |
runs-on: ubuntu-latest | |
# Required for OIDC access to S3 | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Setup R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::pkgdown, local::. | |
needs: website | |
- name: Prepare PTAXSIM database | |
id: prep_ptaxsim_db | |
uses: ./.github/actions/prepare-ptaxsim | |
with: | |
ASSUMED_ROLE: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }} | |
- name: Set PTAXSIM database path | |
run: echo "PTAXSIM_DB_PATH=${{ steps.prep_ptaxsim_db.outputs.PTAXSIM_DB_DIR }}/ptaxsim.db" >> $GITHUB_ENV | |
shell: bash | |
- name: Build pkgdown site | |
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
shell: Rscript {0} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install docs build dependencies | |
run: npm install -g @mermaid-js/mermaid-cli | |
- name: Prepare Mermaid assets for docs | |
run: | | |
for file in inst/mermaid/*.mmd; do | |
# Confine the mermaid process to an AppArmor profile, necessary on | |
# Ubuntu >= 23.10 to work around new AppArmor rules that block the | |
# Puppeteer sandbox (used by mermaid) from working. See: | |
# https://github.com/mermaid-js/mermaid-cli/issues/730#issuecomment-2408615110 | |
aa-exec --profile=chrome mmdc -i "$file" -o "${file/.mmd/.svg}" | |
done | |
mkdir -p docs/mermaid | |
mv inst/mermaid/*.svg docs/mermaid | |
working-directory: ${{ env.PROJECT_DIR }} | |
shell: bash | |
- name: Configure pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'docs' | |
deploy: | |
if: contains(fromJSON('["main", "master"]'), github.ref_name) && github.event_name != 'pull_request' | |
needs: build-pkgdown-site | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |