From 5e8d5ee56d339797e4d9b5ce9424f359a433fab6 Mon Sep 17 00:00:00 2001 From: sist <15859432+stiebels@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:55:21 +0200 Subject: [PATCH 1/3] fix --- .github/workflows/test.yml | 11 +++++++++-- Dockerfile | 1 + action.yml | 9 ++++++++- entrypoint.sh | 12 +++++++----- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd7c416..da2bd64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,13 +17,20 @@ jobs: process: name: Process PlantUML diagram 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 diff --git a/Dockerfile b/Dockerfile index 95bb77a..f54e6f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/action.yml b/action.yml index ccc8664..92c5f0e 100644 --- a/action.yml +++ b/action.yml @@ -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" @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 811e20d..ecf65d7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,10 @@ #!/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 @@ -15,7 +16,8 @@ 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" From 731dc9f4a8e695e8ca1f476e3b9d097e09e030fc Mon Sep 17 00:00:00 2001 From: sist <15859432+stiebels@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:57:17 +0200 Subject: [PATCH 2/3] add upgrade --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index ecf65d7..6e60671 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,7 @@ 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 From c076bf979e37ef58bb1c3b603866a11eb018caf0 Mon Sep 17 00:00:00 2001 From: sist <15859432+stiebels@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:58:13 +0200 Subject: [PATCH 3/3] add upgrade --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da2bd64..a356629 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ jobs: run: bash -c 'shopt -s globstar nullglob; shellcheck **/*.sh' process: name: Process PlantUML diagram + needs: [shellcheck] runs-on: ubuntu-latest env: MODULE: "tests"