Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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