Skip to content

Commit

Permalink
Bugfix png to svg (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
stiebels authored Jul 28, 2023
1 parent 85064d5 commit fee207c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 38 deletions.
16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

12 changes: 0 additions & 12 deletions .gitattributes

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# PlantUML End-to-End Action
A GitHub Action for creating a PlantUML file from a Python module and exporting it as an image.

## Python ➡️ PlantUML ➡️ PNG </b>
This repository was forked from [this repo](https://github.com/Timmy/plantuml-action/tree/5f5f57e2ec41225b88f37aa1dc15edda188b47c8) and extends it by automating the end-to-end process, from generating the PlantUML diagram based on Python modules to exporting that diagram as PNG for ease of access and in-repo rendering.
## Python ➡️ PlantUML ➡️ SVG </b>
This repository was forked from [this repo](https://github.com/Timmy/plantuml-action/tree/5f5f57e2ec41225b88f37aa1dc15edda188b47c8) and extends it by automating the end-to-end process, from generating the PlantUML diagram based on Python modules to exporting that diagram as SVG for ease of access and in-repo rendering.

## Usage
Use it from the GitHub Actions marketplace.

### Example workflow
The following workflow generates a PlantUML diagram from the Python module `tests`
in the `tests` directory and exports it as PUML file as well as PNG to the `diagrams` directory.
in the `tests` directory and exports it as PUML file as well as SVG to the `diagrams` directory.
Subsequently, the changed files are committed and pushed to the repository.

Note that passing of the parameters `puml_version` as well as `py2puml_version` is optional and both default to `latest`. However, it's recommended to pin down their versions.
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
description: the module name of the domain following the py2puml definition
required: true
output_dir:
description: the directory where the PNG should be saved to. File names default to the module name, but differ by file extension (.puml/.png).
description: the directory where the SVG should be saved to. File names default to the module name, but differ by file extension (.puml/.svg).
default: diagrams
required: true
```
12 changes: 6 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ else
echo "File found: ${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.puml"
fi

# Generating the PNG file from the PUML file
# Generating the SVG file from the PUML file
if [ "$INPUT_PUML_VERSION" = "latest" ]; then
wget -O /tmp/plantuml.jar "http://sourceforge.net/projects/plantuml/files/plantuml.jar/download"
else
wget -O /tmp/plantuml.jar "http://sourceforge.net/projects/plantuml/files/plantuml.${INPUT_PUML_VERSION}.jar/download"
fi
java -jar /tmp/plantuml.jar "${INPUT_OUTPUT_DIR}"/"${INPUT_MODULE}".puml -o ../"${INPUT_OUTPUT_DIR}"
java -jar /tmp/plantuml.jar "${INPUT_OUTPUT_DIR}"/"${INPUT_MODULE}".puml -o ../"${INPUT_OUTPUT_DIR}" -tsvg

# Check if a PNG file is found at the expected location
if [ ! -f "${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.png" ]; then
echo "File not found: ${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.png"
# Check if a SVG file is found at the expected location
if [ ! -f "${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.svg" ]; then
echo "File not found: ${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.svg"
exit 1
else
echo "File found: ${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.png"
echo "File found: ${INPUT_OUTPUT_DIR}/${INPUT_MODULE}.svg"
fi

0 comments on commit fee207c

Please sign in to comment.