diff --git a/.github/workflows/RenderAllDiagrams.yml b/.github/workflows/RenderAllDiagrams.yml index e01d80ed..13e357f6 100644 --- a/.github/workflows/RenderAllDiagrams.yml +++ b/.github/workflows/RenderAllDiagrams.yml @@ -5,6 +5,7 @@ on: paths: - '**/Material/images/src/**/*.puml' - '**/Material/images/src/**/*.drawio' + - '**/Material/images/src/**/*.bpmn' branches-ignore: - 'main**' @@ -38,15 +39,16 @@ jobs: run: | wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar" - # Clean Folder + # Ensure Folder exsists, otherwise, create it - name: Ensure and clean folder run: | img_dir=Material/images/diagrams mkdir -p $img_dir - rm -rf Material/images/diagrams/*.svg + # do not clean + # rm -rf Material/images/diagrams/*.svg # Generate the SVGs from PUML - - name: Render PUML to SVG and Move files + - name: Render PUML to SVG files run: | FileNamePaths=$(find . -path "*/images/src/*/*.puml" -exec dirname {} \; | sort -u) for dir in $FileNamePaths @@ -70,7 +72,34 @@ jobs: format: svg action-mode: all + # Install note.js and bpmn-to-image + - name: Install Notejs and pbmn-to-image + uses: actions/setup-node@v4 + with: + node-version: 18 + - run: npm install -g bpmn-to-image + + # Generate the SVGs from BPMN + - name: Render BPMN to SVG files + run: | + FileNamePaths=$(find . -path "*/images/src/*/*.bpmn" -exec dirname {} \; | sort -u) + for dir in $FileNamePaths + do + # Render SVGs from BPMN + echo $dir + FileBaseNames=$(find $dir -name "*.bpmn" -exec basename "{}" ".bpmn" \; | sort -u) + #FileBaseNames=$(find $dir -name "*.bpmn" | xargs -L1 -I{} basename "{}") + + for base in $FileBaseNames + do + echo $base + bpmn-to-image "$dir/$base.bpmn":"$dir/$base.svg"; + done + + done + # copies the created SVG files to the images/diagrams folder and deletes the drawio files + # mv for copy and delete, here - name: Move SVGs to target image folder run: | img_dir=Material/images/diagrams @@ -79,7 +108,8 @@ jobs: for dir in $FileNamePaths do # Move SVGs to out directory - find $dir -name "*.svg" -exec mv {} $img_dir \; + # find $dir -name "*.svg" -exec rm -rf {} $img_dir \; + find $dir -name "*.svg" -exec mv -f {} $img_dir \; done ## add and commit the new generated files @@ -99,4 +129,8 @@ jobs: with: commit_user_name: GitHub Actions Bot commit_user_email: ActionBot@github.com - commit_message: auto-generated diagrams by GitHub Action after source code change \ No newline at end of file + commit_message: auto-generated diagrams by GitHub Action after source code change + + - name: "Run if no changes have been detected" + if: steps.auto-commit-action.outputs.changes_detected == 'false' + run: echo "No Changes!" \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4bbdcef8..6efe3ea9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Java and .NET are already installed on ubuntu-latest @@ -50,7 +50,7 @@ jobs: EXPECTED_FAILS: VALIDATION_CONFORMANCE_DOTNET VALIDATION_CONFORMANCE_JAVA VALIDATION_EXAMPLES_JAVA - name: Add & Commit - uses: EndBug/add-and-commit@v7 + uses: EndBug/add-and-commit@v9 with: committer_name: GitHub Actions Bot committer_email: ActionBot@github.com