Render All Diagrams #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Render All Diagrams | ||
on: | ||
push: | ||
paths: | ||
- '**/Material/imgsrc/**/*.puml' | ||
- '**/Material/imgsrc/**/*.drawio' | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# Installs Java distribution for running the plantUML jar | ||
- name: Install Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
check-latest: true | ||
# Install graphviz for plantuml | ||
- name: Setup Graphviz | ||
uses: ts-graphviz/setup-graphviz@v1 | ||
# Download plantUML jar | ||
- name: Download plantuml file | ||
run: | | ||
wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar" | ||
# Clean Folder | ||
- name: Ensure and clean folder | ||
run: | | ||
imagedir=ImplementationGuide/diagrams | ||
mkdir -p $imagedir | ||
rm -rf ImplementationGuide/diagrams/*.svg | ||
# Generate the SVGs from PUML | ||
- name: Render PUML to SVG and Move files | ||
run: | | ||
imagedir=ImplementationGuide/diagrams | ||
FileNamePaths=$(find . -path "*/imgsrc/*/*.puml" -exec dirname {} \; | sort -u) | ||
for dir in $FileNamePaths | ||
do | ||
# Render SVGs from PUMLs | ||
find $dir -name "*.puml" -exec java -jar plantuml.jar -tsvg {} \; | ||
# Move SVGs to out directory | ||
find $dir -name "*.svg" -exec mv {} $out_dir \; | ||
done | ||
# Generate the SVGs from DrawIO | ||
- name: Render DrawIO to SVG with predefined action | ||
uses: rlespinasse/drawio-export-action@v2 | ||
with: | ||
path: ./Material/imgsrc/drawio/ | ||
output: . | ||
format: svg | ||
action-mode: all | ||
# copies the created png & svg files to the images/diagrams folder and deletes the drawio files | ||
- name: Copy draw io | ||
run: | | ||
imagedir=ImplementationGuide/images/diagrams | ||
cp -RT ./Material/imgsrc/drawio/ $imagedir | ||
find $imagedir -name '*.drawio' -exec rm -rv {} \; | ||
tree ./images | ||
# add and commit the new generated files | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
reviewers: ${{ github.actor }} | ||
Check failure on line 80 in .github/workflows/RenderAllDiagrams.yml GitHub Actions / Render All DiagramsInvalid workflow file
|
||
commit-message: Generated Images from source Code by GitHub Action | ||
#- name: Commit and push | ||
# run: | | ||
# git config --local user.email "[email protected]" | ||
# git config --local user.name "GitHub Action" | ||
# git add -A | ||
# git commit -m "Add rendered PlantUML and DrawIO to SVG diagrams" || exit 0 | ||
# git push |