Skip to content

Update Seq_kas_email_senden.puml #7

Update Seq_kas_email_senden.puml

Update Seq_kas_email_senden.puml #7

name: GenerateImagesFromSrc
on:
push:
branches:
- '**'
paths:
- 'src/plantuml/**'
- 'src/drawio/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Installs Java distribution for running the plantUML jar
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
check-latest: true
# Install graphviz for plantuml
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
# Download plantUML jar
- name: Download plantuml file
run: |
wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/download/v1.2023.10/plantuml-1.2023.10.jar"
# Runs a single command using the runners shell
- name: Generate images
run: |
imagedir=images/diagrams
mkdir -p $imagedir
rm -rf images/diagrams/*
for fullname in $(find src/plantuml/ -type f -name '*.puml')
do
echo "Fullname: ${fullname}"
base=$(basename "${fullname}" .puml)
dir=$(dirname $fullname)
echo "Basename: ${base}"
outdir=$(dirname $fullname | sed s+src/plantuml+${imagedir}+)
echo "Outdir: ${outdir}"
mkdir -p $outdir
plantoutdir="${PWD}/${outdir}"
echo "PlantOutdir: ${plantoutdir}"
# PlantUML arguments:
# -v for verbose output (Debugging)
# -checkmetadata checks whether the target png/svg has the same source
# and if there are no changes, doesn't regenerate the image file
# -o sets the output folder for the png/svg files
plantargs="-v -checkmetadata -o ${plantoutdir} ${fullname}"
# separate calls are needed, because only one file type can be set
# per call
java -jar plantuml.jar -tpng ${plantargs}
java -jar plantuml.jar -tsvg ${plantargs}
# method with pipes
#cat "${fullname}" | java -jar plantuml.jar -p -tpng -checkmetadata > "${outdir}/${base}.png"
#cat "${fullname}" | java -jar plantuml.jar -p -tsvg -checkmetadata > "${outdir}/${base}.svg"
done
tree ./images
# creates png files from draw io image files
- name: Export drawio files as png
uses: rlespinasse/drawio-export-action@v2
with:
path: ./src/drawio/
output: .
format: png
action-mode: all
# creates svg files from draw io image files
- name: Export drawio files
uses: rlespinasse/drawio-export-action@v2
with:
path: ./src/drawio/
output: .
format: svg
action-mode: all
# copies the created png & svg files to the images/diagrams folder and deletes the drawio files
- name: Copy draw io
run: |
imagedir=images/diagrams
cp -RT ./src/drawio $imagedir
find $imagedir -name '*.drawio' -exec rm -rv {} \;
tree ./images
# add and commit the new generated files
- name: Add & Commit
uses: EndBug/add-and-commit@v9
with:
add: 'images/diagrams/'