-
Notifications
You must be signed in to change notification settings - Fork 15
75 lines (63 loc) · 3.45 KB
/
ayab-esp32-documentation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Assembly Documentation
on:
pull_request:
branches:
- main
types:
- closed
push:
branches:
- main
env:
workflow_project_dir: ayab-esp32
kicad_project_name: ayab-esp32
jobs:
buildfiles:
if: github.event.pull_request.merged == true
name: Design check & documentation build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create output directory
run: mkdir -p ${workflow_project_dir}/outputs/gerbers
- name: Install KiCad
run: sudo bash ./scripts/dependencies.sh
- name: Export design file PDFs
run: |
kicad-cli sch export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-sch.pdf ${workflow_project_dir}/${kicad_project_name}.kicad_sch
kicad-cli pcb export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-pcb-front.pdf -l "F.Cu,F.Mask,Edge.Cuts" ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
kicad-cli pcb export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-pcb-back.pdf --erd --ev --mirror -l "B.Cu,B.Mask,Edge.Cuts" ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
- name: Export assembly documentation
run: |
kicad-cli sch export bom -o ${workflow_project_dir}/outputs/raw-BOM.csv --fields "Reference,Value,Footprint,LCSC ID" --exclude-dnp --group-by "Val" --sort-asc ${workflow_project_dir}/${kicad_project_name}.kicad_sch
kicad-cli pcb export pos -o ${workflow_project_dir}/outputs/raw-CPL.csv --side front --format csv --use-drill-file-origin --exclude-dnp ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
- name: Convert BOM & CPL to JLC format
run: |
python3 scripts/jlc_bom_formatter.py ${workflow_project_dir}/outputs/raw-BOM.csv ${workflow_project_dir}/outputs/${kicad_project_name}-BOM.csv
python3 scripts/jlc_cpl_formatter.py ${workflow_project_dir}/outputs/raw-CPL.csv ${workflow_project_dir}/outputs/${kicad_project_name}-CPL.csv
sudo rm ${workflow_project_dir}/outputs/raw-BOM.csv ${workflow_project_dir}/outputs/raw-CPL.csv
- name: Export mechanical files
run: |
kicad-cli pcb export gerbers -o ${workflow_project_dir}/outputs/gerbers/ -l "F.Cu,F.Mask,F.Silkscreen,F.Paste,In1.Cu,In2.Cu,B.Cu,B.Mask,B.Silkscreen,B.Paste,Edge.Cuts"--erd --ev --use-drill-file-origin --no-protel-ext ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
kicad-cli pcb export drill -o ${workflow_project_dir}/outputs/gerbers/ --drill-origin plot --format gerber ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
cd ${workflow_project_dir}/outputs
zip -r ${kicad_project_name}-gerbers.zip gerbers
sudo rm -r gerbers
- name: Add PDFs to repo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "AYAB Github Action"
git fetch
git checkout documentation
git add ${workflow_project_dir}/pdf/*.pdf
git commit -m "Add design file PDFs to repo [skip ci]"
gh pr create --head documentation --base main --title "Add design file PDFs to repo" --body "Automated PR from GHA"
- name: Archive artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: documentation-artifacts
path: ayab-esp32/outputs