-
Notifications
You must be signed in to change notification settings - Fork 5
/
entrypoint.sh
executable file
·55 lines (36 loc) · 1009 Bytes
/
entrypoint.sh
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
#!/bin/bash
set -e
echo "Generating C4 model"
source="$GITHUB_WORKSPACE/$1"
source_dir="$(dirname "$source")"
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
target_dir="$GITHUB_WORKSPACE/$2"
if [ ! -f "$source" ]; then
echo "Structurizr DSL file '$source' not found" >&2
exit 1
fi
echo "[params]
source: $source
target dir: $target_dir"
echo "Exporting Structurizr DSL to PlantUML format"
/structurizr-cli/structurizr.sh export -w "$source" -f "plantuml"
if [ $? -ne 0 ]; then
echo "An error occurred when attempting to export to PlantUML format" >&2
exit $?
fi
ls "$source_dir"/*.puml >/dev/null
if [ $? -ne 0 ]; then
echo "Did not generate any PlantUML files" >&2
exit $?
fi
echo "Moving PlantUML files to '$tmp_dir'"
mkdir -p "$tmp_dir"
mv "$source_dir"/*.puml "$tmp_dir"
echo "Generating .png images"
plantuml "$tmp_dir"/*.puml
echo "Moving C4 images to '$target_dir'"
mkdir -p "$target_dir"
mv "$tmp_dir"/*.png "$target_dir"
ls -la "$target_dir"
echo "Finished"
exit 0