Skip to content

Commit

Permalink
Feature/render mermaid (#2)
Browse files Browse the repository at this point in the history
Ad pipeline stage 

---------

Co-authored-by: Timo Huber <[email protected]>
  • Loading branch information
timohuber and timohuber authored Jul 12, 2024
1 parent 29f6688 commit 372ee49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
branches: ["main", "feature/render-mermaid"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -32,16 +32,15 @@ jobs:
with:
image: minlag/mermaid-cli:latest
options: -v ${{ github.workspace }}:/app -w /app
run:
chmod +x /app/scripts/render-images.sh
/app/scripts/render-images.sh
run: |
chmod +x ./scripts/render-images.sh
CI=true ./scripts/render-images.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: diagrams
path: ./docs/images
path: docs/images

# Build job
build:
runs-on: ubuntu-latest
needs: build-diagrams
Expand All @@ -52,7 +51,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: diagrams
path: ./docs/images
path: docs/images
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
Expand All @@ -63,7 +62,6 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
Expand Down
13 changes: 11 additions & 2 deletions scripts/render-images.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/bash
#!/bin/sh

input_dir="diagrams"
output_dir="docs/images"

command_path=$( [ -z "$CI" ] && echo "." || echo "/home/mermaidcli" )
config_path=$( [ -z "$CI" ] && echo "." || echo "")

mkdir -p "$output_dir"

echo "Start rendering mermaid diagrams"

for file in "$input_dir"/*.mmd; do
echo "rendering $file"

base_name=$(basename "$file" .mmd)
./node_modules/.bin/mmdc -p puppeteer-config.json -i "$file" -o "$output_dir/${base_name}.svg" -b transparent
"$command_path/node_modules/.bin/mmdc" -p "$config_path/puppeteer-config.json" -i "$file" -o "$output_dir/${base_name}.svg" -b transparent
done

echo "Rendering mermaid diagrams completed."

0 comments on commit 372ee49

Please sign in to comment.