Generate Circuit Diagrams #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Circuit Diagrams | |
on: | |
push: | |
paths: | |
- "docs/schematics/wiring/*.py" | |
workflow_dispatch: | |
jobs: | |
generate-circuits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Forces GitHub to pull the latest commit | |
- name: Install System Dependencies (cairo) | |
run: | | |
sudo apt update | |
sudo apt install -y libcairo2-dev | |
- name: Install Python & SKiDL | |
run: | | |
sudo apt install -y python3-pip | |
pip3 install skidl pycairo | |
- name: Set KiCad Library Path | |
run: echo "KICAD_SYMBOL_DIR=/usr/share/kicad/symbols" >> $GITHUB_ENV | |
- name: Run SKiDL Scripts to Generate Netlists | |
run: | | |
python3 docs/schematics/wiring/cinemate_circuit_simple.py | |
python3 docs/schematics/wiring/cinemate_circuit_advanced.py | |
- name: Convert Netlists to PNG | |
run: | | |
pip3 install netlistsvg | |
netlistsvg docs/schematics/wiring/cinemate_circuit_simple.net -o docs/schematics/wiring/cinemate_circuit_simple.png | |
netlistsvg docs/schematics/wiring/cinemate_circuit_advanced.net -o docs/schematics/wiring/cinemate_circuit_advanced.png | |
- name: Commit Generated PNGs | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "actions@github.com" | |
git add docs/schematics/wiring/*.png | |
git commit -m "Auto-generated circuit diagrams" | |
git push |