Skip to content

Commit

Permalink
Add diagrams and GitHub Action.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 21, 2024
1 parent 2b76ff8 commit 94167e3
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy D2 documentation to pages

on:
push:
branches: [ diagrams ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v4
- name: Install packages
run: curl -fsSL https://d2lang.com/install.sh | sh -s --
- name: Generate diagrams
run: |
for file in diagrams/*.d2; do
base="${file%.*}"
~/.local/bin/d2 $file _site/$base.svg -t 105 --sketch
done
- name: Generate index
run: |
echo '<ul>' > _site/diagrams/index.html
for file in _site/diagrams/*; do
name="${s##*/}"
echo "<li><a href='$name'>$name</a></li>" >> _site/diagrams/index.html
done
echo '</ul>' >> _site/diagrams/index.html
- uses: actions/upload-pages-artifact@v3
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
package-lock.json

/diagrams/*.svg
42 changes: 42 additions & 0 deletions diagrams/kingston-request.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Pick container: Which container do you need?
Replacement: Why do you need a\nreplacement container?
Replacement2: Why do you need a\nreplacement container?
Recycling swap: Would you like to replace\nyour recycling box containers\nwith a wheelie bin?
Recycling swap2: Would you like to replace\nyour recycling box containers\nwith a wheelie bin?
Recycling number: How many\nboxes/\ncontainers?
Recycling number2: How many\nboxes/\ncontainers?
Notes missing: Can you give us any\ninformation about what\nhappened to your container?
Notes damaged: What happened to\nyour container?
About you1: About/\nSummary/\nEND { style.fill: lightgrey }
About you2: About/\nSummary/\nEND { style.fill: lightgrey }
About you3: Confirm\nAbout/\nSummary/\nEND { style.fill: lightgrey }
About you4: About/\nSummary/\nEND { style.fill: lightgrey }
About you5: About/\nSummary/\nEND { style.fill: lightgrey }
About you6: About/\nSummary/\nEND { style.fill: lightgrey }
About you7: Confirm\nAbout/\nSummary/\nEND { style.fill: lightgrey }

Pick container -> Replacement: Other
Pick container -> Recycling swap: Recycling bin\n(don’t have a bin)
Pick container -> About you1: Recycling blue stripe bag\nor Paper single use bag
Pick container -> Replacement2: Recycling box

Replacement2 -> Recycling number2: Damaged/\nMissing
Replacement2 -> Recycling number: New resident\nwithout\na container
Replacement2 -> Recycling swap2: I need an additional\ncontainer/bin

Replacement -> About you2: New resident\nwithout\na container
Replacement -> Notes damaged: Damaged
Replacement -> Notes missing: Missing

Recycling swap -> Replacement: No
Recycling swap -> About you3: Yes

Recycling swap2 -> Recycling number: No
Recycling swap2 -> About you7: Yes

Recycling number2 -> Notes damaged: Damaged
Recycling number2 -> Notes missing: Missing
Recycling number -> About you4

Notes missing -> About you5
Notes damaged -> About you6
21 changes: 21 additions & 0 deletions diagrams/sutton-bulky.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
shape: sequence_diagram

user: { shape: person }

user -> WasteWorks: Submits\nbulky form

WasteWorks.t -> Echo: PostEvent with\nevent details

WasteWorks.t -> Payment\nprovider: Redirect user to\npayment provider

Payment\nprovider -> WasteWorks: Redirect back after\nsuccessful payment

WasteWorks."Parameters verified\nusing SHA-OUT"

WasteWorks.t2 -> User: Payment confirmation screen

WasteWorks.t2 -> User: Email with booking details

WasteWorks.t2 -> Echo: UpdateEvent with\npayment details


8 changes: 8 additions & 0 deletions diagrams/sutton-request.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Pick container: Which container do you need?
Replacement: Why do you need a\nreplacement container?
About you: About/\nSummary/\nEND { style.fill: lightgrey }

Pick container -> Replacement: Other
Pick container -> About you: Recycling blue stripe bag\nor Paper single use bag

Replacement -> About you: Damaged/\nMissing

0 comments on commit 94167e3

Please sign in to comment.