Skip to content

Commit

Permalink
Github pages automatic deployment mermaid diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
ravimeijerrig committed Sep 5, 2024
1 parent 4a66989 commit cdabb0f
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,29 @@ jobs:
git push --force-with-lease
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Configure Git Identity
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Generate mermaid diagrams
run: ./script/gen_mermaid.py

- name: Commit to deployment branch
run: |
git fetch
git checkout --orphan deployment
git add mermaid_graphs
git commit -m 'Auto-generate mermaid diagrams'
git push --force origin deployment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions script/gen_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def find_node_by_id(node_id):
title=name, nodes=nodes, links=links, orientation=orientation, config=config
)
create_html(
"./mermaid_links/decision-tree-complete.html",
"./mermaid_graphs/decision-tree-complete.html",
flowchart_complete.script + subgraphs_complete,
)

Expand Down Expand Up @@ -386,7 +386,7 @@ def get_category(subgraphs, link):
)

create_html(
"./mermaid_links/decision-tree-subgraphs-" + category + ".html",
"./mermaid_graphs/decision-tree-subgraphs-" + category + ".html",
flowchart.script + "\n" + htmls,
)

Expand Down Expand Up @@ -418,7 +418,7 @@ def get_category(subgraphs, link):
flowchart_main = FlowChart(title=name, config=config)

create_html(
"./mermaid_links/decision-tree-main.html",
"./mermaid_graphs/decision-tree-main.html",
flowchart_main.script + pairs_main + "\n" + labels_per_category + "\n" + htmls,
)

Expand Down

0 comments on commit cdabb0f

Please sign in to comment.