docs: update documentation #9
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: Render SVG files | |
on: | |
push: | |
paths: | |
- man/**logo.svg | |
workflow_dispatch: | |
jobs: | |
render-svg: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
- name: Install dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | | |
any::magick | |
any::rsvg | |
- name: Render logo SVG | |
run: | | |
library(magick) | |
svg_path <- list.files( | |
"man/figures", | |
paste0(read.dcf("DESCRIPTION")[1, "Package"], "-logo.svg"), | |
full.names = TRUE) | |
stopifnot(length(svg_path) == 1) | |
image_read_svg(svg_path) |> | |
image_crop("100%x50%") |> | |
image_trim() |> | |
image_resize("240x278") |> | |
image_write("man/figures/logo.png") | |
shell: Rscript {0} | |
- name: Commit and push changes | |
run: | | |
git config --local user.name "${{ github.actor }}" | |
git config --local user.email "${{ github.actor }}@users.noreply.github.com" | |
git add man/\* | |
git commit -m "Update logo from SVG" || echo "No changes to commit" | |
git pull --ff-only | |
git push origin |