-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (62 loc) · 1.92 KB
/
plantuml.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Generate PlantUML Diagrams
on:
push:
branches:
- main
paths:
- 'diagrams/*.puml' # Only trigger on changes to .puml files
pull_request:
branches:
- main
paths:
- 'diagrams/*.puml' # Only trigger on changes to .puml files
jobs:
generate-diagrams:
runs-on: ubuntu-latest
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: '11'
- name: Install PlantUML and Graphviz
run: |
sudo apt-get update
sudo apt-get install -y plantuml graphviz
- name: List PUML files (Debugging Step)
run: |
find diagrams/ -name '*.puml'
- name: Confirm .puml Files Exist (Debugging Step)
run: |
if ! compgen -G "diagrams/*.puml" > /dev/null; then
echo "No .puml files found to generate diagrams."
exit 1
fi
- name: Generate Diagrams
run: |
plantuml -tpng diagrams/*.puml -o png/
- name: Check Generated PNGs (Debugging Step)
run: |
ls -l diagrams/png/*.png || echo "No .png files generated."
- name: Commit and Push Diagrams
run: |
if ls diagrams/png/*.png 1> /dev/null 2>&1; then
# Configure git user
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
# Stage all PNG files (new and modified)
git add diagrams/png/*.png
# Check if there are any staged changes
if git diff --cached --exit-code; then
echo "No changes in diagrams. Skipping commit."
else
git commit -m "Add or update generated PlantUML diagrams"
git push
fi
else
echo "No .png files generated."
fi