Skip to content

Commit

Permalink
initial diagram for codespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobFerdinand committed Mar 6, 2024
1 parent 81b4f14 commit 7ea9cbf
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"features": {
"ghcr.io/devcontainers-contrib/features/mkdocs:2": {}
},
"postCreateCommand": "pip3 install mkdocs-material mkdocs-awesome-pages-plugin mkdocs-minify-plugin",
"postCreateCommand": "postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip3 install mkdocs-material mkdocs-awesome-pages-plugin mkdocs-minify-plugin

curl -fsSL https://d2lang.com/install.sh | sh -s --
32 changes: 32 additions & 0 deletions .github/workflows/create-diagram-svgs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Create diagram SVGs"

on:
push:
branches:
- main
paths:
- .github/workflows/create-diagram-svgs.yml
- src/diagrams/*.d2

jobs:
create-diagram-svgs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install d2
run: curl -fsSL https://d2lang.com/install.sh | sh -s --

- name: Generate SVGs
run: |
find "$GITHUB_WORKSPACE/diagrams" -name "*.svg" -delete
for d2_file in $(find "$GITHUB_WORKSPACE/src/diagrams" -name "*.d2"); do
filename=$(basename -- "$d2_file")
output_file="$GITHUB_WORKSPACE/diagrams/${filename%.d2}.svg"
d2 --theme=3 -l elk "$d2_file" "$output_file"
done
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Create diagram SVGs
1 change: 1 addition & 0 deletions diagrams/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hier werden automatisch alle Diagramme aus der GitHub Action abgelegt.
10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ Die RZL Hilfe gebaut aus Markdown File mit Hilfe von [Material for MkDocs](https

## Contribute

Eine live Preview kann lokal mit diesem Befehl gestartet werdern:
Für das Anpassen und Erstellen der RZL Hilfe werden [GitHub Codespaces](https://github.com/features/codespaces) verwendet.
Dadurch kann sichergestellt werden, dass alle Abhängigkeiten und Tools bereits installiert und richtig eingerichtet sind.

Der Ablauf für das Starten eines Codespaces ist wie folgt:
![GitHub Codespaces](diagrams/codespaces.svg)

Ist der Codespace vollständig gestartet und im [Visual Studio Code](https://code.visualstudio.com/) geöffnet, kann mit dem drücken der `F5` Taste eine live Preview gestartet werden.

Im Hintergrund führt `F5` diesen Befehl aus:
```
mkdocs serve
```
40 changes: 40 additions & 0 deletions src/diagrams/codespaces.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
direction: down

GitHub : {
label: Starten aus GitHub
style: {
stroke: blue
stroke-dash: 3
fill: transparent
}

exists : {
label: "Existiert bereits ein Codespace?"
shape: image
icon: ./src/diagrams/img/does-codespace-exist.png
}

create : {
label: "Codespace erstellen"
}

exists -> create: "Nein"

open : {
label: "Codespace im VS Code öffnen"
shape: image
icon: ./src/diagrams/img/open-existing-codespace.png
}

exists -> open: "Ja"
}

VSCode : {
label: "Starten aus VS Code"
style: {
stroke: blue
stroke-dash: 3
fill: transparent
}
near: bottom-center
}
Binary file added src/diagrams/img/does-codespace-exist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/diagrams/img/open-existing-codespace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ea9cbf

Please sign in to comment.