Merge pull request #57 from gematik/feature/KIMDokumentation_new #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GeneratePlantumlImages | |
on: | |
push: | |
branches: [ '*' ] | |
paths: [ 'src/plantuml/**' ] | |
# Allows you to run this workflow manually from the Actions tab | |
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@v2 | |
# 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.2022.5/plantuml-1.2022.5.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 | |
# 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 ./ | |
- name: Add & Commit | |
uses: EndBug/add-and-commit@v8 | |
with: | |
add: 'images/diagrams/' |