-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerate-architecture-diagrams.yml
More file actions
70 lines (59 loc) · 2.1 KB
/
Copy pathgenerate-architecture-diagrams.yml
File metadata and controls
70 lines (59 loc) · 2.1 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Generate Architecture Diagrams
on:
workflow_dispatch:
pull_request:
paths:
- "src/**"
- "modules/**"
- "docs/diagrams/assets/**"
- "docs/diagrams/scripts/generate_example_architecture.py"
- "docs/diagrams/README.md"
push:
branches:
- main
paths:
- "src/**"
- "modules/**"
- "docs/diagrams/assets/**"
- "docs/diagrams/scripts/generate_example_architecture.py"
- "docs/diagrams/README.md"
permissions:
contents: write
jobs:
generate-diagrams:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Mermaid CLI
run: npm install -g @mermaid-js/mermaid-cli
- name: Generate architecture diagrams
run: python3 docs/diagrams/scripts/generate_example_architecture.py --out-dir docs/diagrams
- name: Render Mermaid SVG diagrams
run: |
for diagram in docs/diagrams/*.mmd; do
output="${diagram%.mmd}.svg"
mmdc -i "$diagram" -o "$output" -c .github/mermaid-config.json -p .github/mermaid-puppeteer-config.json
done
- name: Verify generated diagrams are committed (PR)
if: github.event_name == 'pull_request'
run: |
if [[ -n "$(git status --porcelain -- docs/diagrams)" ]]; then
echo "::error::Generated diagrams are out of date. Run the generator locally and commit the changes."
git status --short -- docs/diagrams
exit 1
fi
- name: Commit updated diagrams (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.actor != 'github-actions[bot]'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(diagrams): regenerate architecture diagrams"
file_pattern: docs/diagrams/*.mmd docs/diagrams/*.mmd.md docs/diagrams/*.svg