remove example
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
name: Generate UML
|
||||
|
||||
# Trigger whenever the domain model or the generator script itself changes.
|
||||
# "workflow_dispatch" lets you re-run it manually from the GitHub UI.
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "src/netdiag/domain/models.py"
|
||||
- "scripts/generate_uml.py"
|
||||
workflow_dispatch:
|
||||
|
||||
# The job needs write access so it can push the generated files back.
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
generate-uml:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# ── 1. check out the repository ────────────────────────────────────────
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# ── 2. set up Python (stdlib only – no pip packages needed) ────────────
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
# ── 3. generate UML/UML.d2 from models.py ──────────────────────────────
|
||||
- name: Generate D2 source
|
||||
run: python scripts/generate_uml.py src/netdiag/domain/models.py UML/UML.d2
|
||||
|
||||
# ── 4. install the D2 CLI ───────────────────────────────────────────────
|
||||
#
|
||||
# The official install script detects the platform and drops the binary
|
||||
# into one of several locations depending on how the shell is invoked.
|
||||
# We add all common candidates to GITHUB_PATH so the next step finds it
|
||||
# regardless of where the script chose to install.
|
||||
#
|
||||
# Pin a specific version to keep renders reproducible.
|
||||
# Bump this when you want to adopt a newer D2 release.
|
||||
- name: Install D2
|
||||
env:
|
||||
D2_VERSION: "0.7.1"
|
||||
run: |
|
||||
curl -fsSL \
|
||||
"https://github.com/terrastruct/d2/releases/download/v${D2_VERSION}/d2-v${D2_VERSION}-linux-amd64.tar.gz" \
|
||||
| tar -xz -C /tmp
|
||||
sudo install -m 0755 \
|
||||
"/tmp/d2-v${D2_VERSION}-linux-amd64/bin/d2" \
|
||||
/usr/local/bin/d2
|
||||
d2 --version
|
||||
|
||||
# ── 5. render SVG ───────────────────────────────────────────────────────
|
||||
- name: Render UML/UML.svg
|
||||
run: d2 UML/UML.d2 UML/UML.svg
|
||||
|
||||
# ── 6. commit generated files back to the repo ─────────────────────────
|
||||
#
|
||||
# stefanzweifel/git-auto-commit-action is a thin wrapper around
|
||||
# "git add / git commit / git push". It silently skips the commit when
|
||||
# nothing has changed, so re-running the workflow is always safe.
|
||||
#
|
||||
# The "[skip ci]" suffix prevents this commit from re-triggering CI
|
||||
# (GitHub Actions honors this convention natively).
|
||||
- name: Commit generated UML files
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "chore: auto-generate UML diagrams [skip ci]"
|
||||
file_pattern: "UML/UML.d2 UML/UML.svg"
|
||||
Reference in New Issue
Block a user