generated from finos-labs/project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 123
68 lines (56 loc) · 2 KB
/
render-c4-diagrams.yml
File metadata and controls
68 lines (56 loc) · 2 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
name: Render C4 Diagrams
on:
push:
paths:
- 'docs/c4/workspace.dsl'
branches:
- main
pull_request:
paths:
- 'docs/c4/workspace.dsl'
workflow_dispatch: # Allow manual trigger
jobs:
render:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Graphviz
run: |
sudo apt-get update
sudo apt-get install -y graphviz
- name: Render C4 diagrams
run: |
# Download Structurizr CLI
curl -L https://github.com/structurizr/cli/releases/download/v2024.07.03/structurizr-cli.zip -o structurizr-cli.zip
unzip -o structurizr-cli.zip -d structurizr-cli
cd docs/c4
# Export to Graphviz DOT format (produces structurizr-{view-key}.dot files)
../../structurizr-cli/structurizr.sh export -workspace workspace.dsl -format dot -output .
# Convert DOT to PNG using Graphviz with curved splines
for dot_file in structurizr-*.dot; do
output_name="${dot_file%.dot}.png"
dot -Gsplines=curved -Tpng "$dot_file" -o "$output_name"
done
# Clean up DOT files (keep only PNGs)
rm -f *.dot
# List generated files
echo "Generated files:"
ls -la structurizr-*.png
- name: Commit rendered diagrams
if: github.event_name == 'push'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add docs/c4/*.png
git diff --staged --quiet || git commit -m "chore: auto-render C4 diagrams from workspace.dsl"
git push