Skip to content

Commit

Permalink
Merge pull request #2 from stiebels/fix-action
Browse files Browse the repository at this point in the history
  • Loading branch information
stiebels authored Jul 27, 2023
2 parents cba000f + c076bf9 commit 96adeb2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ jobs:
run: bash -c 'shopt -s globstar nullglob; shellcheck **/*.sh'
process:
name: Process PlantUML diagram
needs: [shellcheck]
runs-on: ubuntu-latest
env:
MODULE: "tests"
OUTPUT_DIR: "diagrams"
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Build & render diagram
uses: ./
with:
args: "diagrams tests tests latest"
puml_version: "latest"
py2puml_version: "latest"
path: "tests"
module: ${{ env.MODULE }}
output_dir: ${{ env.OUTPUT_DIR }}
- name: Display diagram
run: |
cat diagrams/tests.png
cat ${{ env.OUTPUT_DIR }}/${{ env.MODULE }}.png
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:3.11

# Install plantuml dependencies as well as python
RUN apk add --no-cache openjdk11-jre graphviz ttf-droid ttf-droid-nonlatin python3
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
9 changes: 8 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ description: GitHub Action for drawing UML diagrams with PlantUML
inputs:
puml_version:
description: PlantUML software version
required: false
default: "latest"
required: true
py2puml_version:
description: py2puml python package version
default: "latest"
Expand All @@ -21,6 +22,12 @@ inputs:
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.puml_version }}
- ${{ inputs.py2puml_version }}
- ${{ inputs.path }}
- ${{ inputs.module }}
- ${{ inputs.output_dir }}
branding:
color: green
icon: code
14 changes: 8 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/bin/sh -l

INPUT_OUTPUT_DIR="${1}"
INPUT_PATH="${2}"
INPUT_MODULE="${3}"
INPUT_PY2PUML_VERSION="${4}"
INPUT_PUML_VERSION="${1}"
INPUT_PY2PUML_VERSION="${2}"
INPUT_PATH="${3}"
INPUT_MODULE="${4}"
INPUT_OUTPUT_DIR="${5}"


if [ "$INPUT_PY2PUML_VERSION" = "latest" ]; then
pip install py2puml
pip install py2puml --upgrade
else
pip install py2puml=="${INPUT_PY2PUML_VERSION}"
fi

mkdir -p "${INPUT_OUTPUT_DIR}"
py2puml "${INPUT_PATH}" "${INPUT_MODULE}" > "${INPUT_OUTPUT_DIR}"/"${INPUT_MODULE}".puml

if [ -z "$INPUT_VERSION" ]; then

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"
Expand Down

0 comments on commit 96adeb2

Please sign in to comment.