Browse Source

add github pages docs with auto generated schematics and pcb layout

Thomas Buck 10 months ago
parent
commit
3d857446a1

+ 51
- 0
.github/workflows/docs.yml View File

@@ -0,0 +1,51 @@
1
+name: Docs
2
+
3
+# only build single instance of docs for latest main branch
4
+on:
5
+  push:
6
+    branches:
7
+      - main
8
+
9
+jobs:
10
+  deploy:
11
+    runs-on: ubuntu-latest
12
+
13
+    permissions:
14
+      contents: write
15
+      pages: write
16
+      id-token: write
17
+
18
+    steps:
19
+      - name: Checkout repo
20
+        uses: actions/checkout@v4
21
+        with:
22
+          fetch-depth: 0
23
+
24
+      - name: Install dependencies
25
+        run: |
26
+          sudo add-apt-repository --yes ppa:kicad/kicad-7.0-releases
27
+          sudo apt update
28
+          sudo apt install -y --install-recommends kicad
29
+
30
+      - name: Install latest mdbook
31
+        run: |
32
+          tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
33
+          url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
34
+          mkdir mdbook
35
+          curl -sSL $url | tar -xz --directory=./mdbook
36
+          echo `pwd`/mdbook >> $GITHUB_PATH
37
+
38
+      - name: Build Book
39
+        run: docs/generate_docs.sh
40
+
41
+      - name: Setup Pages
42
+        uses: actions/configure-pages@v2
43
+
44
+      - name: Upload artifact
45
+        uses: actions/upload-pages-artifact@v1
46
+        with:
47
+          path: 'docs/book'
48
+
49
+      - name: Deploy to GitHub Pages
50
+        id: deployment
51
+        uses: actions/deploy-pages@v1

+ 40
- 0
.github/workflows/kicad.yml View File

@@ -0,0 +1,40 @@
1
+name: PCB
2
+
3
+# build for each push and pull request
4
+on: [push, pull_request]
5
+
6
+jobs:
7
+  fabrication:
8
+    runs-on: ubuntu-latest
9
+
10
+    permissions:
11
+      contents: write
12
+
13
+    steps:
14
+      - name: Checkout repo
15
+        uses: actions/checkout@v4
16
+        with:
17
+          fetch-depth: 0
18
+
19
+      - name: Install dependencies
20
+        run: |
21
+          sudo add-apt-repository --yes ppa:kicad/kicad-7.0-releases
22
+          sudo apt update
23
+          sudo apt install -y --install-recommends kicad
24
+          sudo apt-get install -y zip
25
+
26
+      - name: Generate fabrication files
27
+        run: |
28
+          ./hardware/generate_fab.sh
29
+
30
+      - name: Upload board files
31
+        uses: actions/upload-artifact@v4.0.0
32
+        with:
33
+          name: dispensy-pcb
34
+          path: hardware/fabrication
35
+
36
+      - name: Upload release files
37
+        if: startsWith(github.ref, 'refs/tags/')
38
+        uses: softprops/action-gh-release@v1
39
+        with:
40
+          files: hardware/fab.zip

+ 3
- 0
README.md View File

@@ -1,3 +1,6 @@
1 1
 # Dispensy
2 2
 
3
+![PCB](https://github.com/drinkrobotics/dispensy/actions/workflows/kicad.yml/badge.svg)
4
+![Docs](https://github.com/drinkrobotics/dispensy/actions/workflows/docs.yml/badge.svg)
5
+
3 6
 One day aims to be a new hardware base for the [DrinkRobotics UbaBot](https://www.xythobuz.de/drinkrobotics.html).

+ 3
- 0
docs/.gitignore View File

@@ -0,0 +1,3 @@
1
+book
2
+src/plot
3
+src/inc_*.md

+ 13
- 0
docs/README.md View File

@@ -0,0 +1,13 @@
1
+# Dispensy Documentation
2
+
3
+You can find the [documentation here on GitHub pages](https://drinkrobotics.github.io/dispensy/).
4
+This file is intended for contributors that want to modify this website!
5
+
6
+## Local Build
7
+
8
+The docs are built using [mdbook](https://github.com/rust-lang/mdBook).
9
+Get the [latest release from GitHub](https://github.com/rust-lang/mdBook/releases) for a pre-built binary if you want to test changes to the docs locally.
10
+
11
+    mdbook serve --open docs
12
+
13
+This will open your browser to a local development instance of the docs.

+ 11
- 0
docs/book.toml View File

@@ -0,0 +1,11 @@
1
+[book]
2
+title = "Dispensy"
3
+authors = ["xythobuz"]
4
+description = "Documentation for Dispensy, the universal Cocktail Machine hardware."
5
+language = "en"
6
+multilingual = false
7
+src = "src"
8
+
9
+[output.html]
10
+git-repository-url = "https://github.com/drinkrobotics/dispensy"
11
+edit-url-template = "https://github.com/drinkrobotics/dispensy/edit/main/docs/{path}"

+ 30
- 0
docs/generate_docs.sh View File

@@ -0,0 +1,30 @@
1
+#!/bin/bash
2
+
3
+cd "$(dirname "$0")"
4
+
5
+echo "Generating plots"
6
+rm -rf src/plot
7
+../hardware/generate_plot.sh
8
+cp -r ../hardware/plot src
9
+
10
+echo "Generating plot includes"
11
+rm -rf src/inc_dispensy_sch.md
12
+for f in src/plot/dispensy_sch.svg/*.svg; do
13
+    file=`echo $f | sed 's:src/:./:g'`
14
+    name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
15
+    echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
16
+    echo "<div style=\"background-color: white;\">" >> src/inc_dispensy_sch.md
17
+    echo "<a href=\"$file\">" >> src/inc_dispensy_sch.md
18
+    echo "<img src=\"$file\" alt=\"Main-Board PCB layout as SVG\">" >> src/inc_dispensy_sch.md
19
+    echo "</a></div>" >> src/inc_dispensy_sch.md
20
+    echo >> src/inc_dispensy_sch.md
21
+done
22
+
23
+echo "Generating docs"
24
+if [ "$1" = "serve" ] ; then
25
+    mdbook serve --open
26
+elif [ "$1" = "build" ] ; then
27
+    mdbook build
28
+else
29
+    echo "Invalid command. 'build' or 'serve'."
30
+fi

+ 11
- 0
docs/src/SUMMARY.md View File

@@ -0,0 +1,11 @@
1
+# Summary
2
+
3
+# Dispensy
4
+
5
+- [Introduction](./introduction.md)
6
+
7
+# Hardware
8
+
9
+- [Main-Board](./main_board.md)
10
+  - [Schematics](./main_board_sch.md)
11
+  - [PCB Layout](./main_board_pcb.md)

+ 3
- 0
docs/src/introduction.md View File

@@ -0,0 +1,3 @@
1
+# Introduction
2
+
3
+**TODO** work in progress

+ 3
- 0
docs/src/main_board.md View File

@@ -0,0 +1,3 @@
1
+# Main-Board
2
+
3
+**TODO** work in progress

+ 11
- 0
docs/src/main_board_pcb.md View File

@@ -0,0 +1,11 @@
1
+# Main-Board PCB Layout
2
+
3
+This page shows the current version of the PCB layout as SVG graphics.
4
+
5
+You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
6
+
7
+<div style="background-color: white;">
8
+    <a href="./plot/dispensy_pcb.svg">
9
+        <img src="./plot/dispensy_pcb.svg" alt="Main-Board PCB layout as SVG">
10
+    </a>
11
+</div>

+ 7
- 0
docs/src/main_board_sch.md View File

@@ -0,0 +1,7 @@
1
+# Main-Board Schematics
2
+
3
+This page shows the current version of the schematics as SVG graphics.
4
+
5
+You can also view the [Main-Board schematics as PDF](./plot/dispensy_sch.pdf).
6
+
7
+{{#include inc_dispensy_sch.md}}

+ 1
- 0
hardware/generate_plot.sh View File

@@ -24,4 +24,5 @@ do
24 24
         -l $LAYER \
25 25
         -o $OUTDIR/dispensy_pcb.$VAR \
26 26
         dispensy.kicad_pcb
27
+    echo
27 28
 done

Loading…
Cancel
Save