-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.55 KB
/
dot-to-svg.yml
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
52
53
54
55
56
57
name: Generate SVG from DOT and commit
on:
push:
paths:
- 'docs/diagramma-er.dot'
jobs:
generate-svg:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if SVG file is modified
id: svg-changed
run: |
SVG_CHANGED=$(git diff --name-only HEAD^ HEAD | grep 'docs/diagramma-er-gv.svg' || true)
echo "SVG_CHANGED=${SVG_CHANGED}" >> $GITHUB_ENV
- name: Exit if SVG not changed
run: exit 0
if: env.SVG_CHANGED == ''
- name: Configure Git
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Cache Graphviz installation
id: cache-graphviz
uses: actions/cache@v3
with:
path: /var/cache/apt/archives
key: graphviz-${{ runner.os }}-${{ hashFiles('**/apt-get.lock') }}
restore-keys: |
graphviz-${{ runner.os }}-
- name: Install Graphviz
shell: bash
run: |
sudo apt update
sudo apt -f install
sudo apt install -y graphviz
- name: Generate SVG from DOT
run: dot -Tsvg docs/diagramma-er.dot -o docs/diagramma-er-gv.svg
- name: Commit and push changes
run: |
git add docs/diagramma-er-gv.svg
git commit -m "Generate SVG from DOT"
git push origin