-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (40 loc) · 1.23 KB
/
render-svg.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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