|
| 1 | +name: Generate Production Files |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + pull_request: |
| 10 | + |
| 11 | +env: |
| 12 | + IBOM_VERSION: 2.11.2 |
| 13 | + KIKIT_VERSION: 1.8.0 |
| 14 | + |
| 15 | +jobs: |
| 16 | + generate-prod-files: |
| 17 | + runs-on: ubuntu-24.04 |
| 18 | + container: |
| 19 | + image: kicad/kicad:10.0 |
| 20 | + options: --user root |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + project: [pblprog-sifli-board, pblprog-sifli-flex] |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v6 |
| 27 | + |
| 28 | + - name: Create output directory |
| 29 | + run: | |
| 30 | + mkdir output |
| 31 | +
|
| 32 | + - name: Export schematic to PDF |
| 33 | + run: | |
| 34 | + kicad-cli sch export pdf -n -o output/schematic.pdf ${{ matrix.project }}/${{ matrix.project }}.kicad_sch |
| 35 | +
|
| 36 | + - name: Export PCB drawings to PDF |
| 37 | + run: | |
| 38 | + kicad-cli pcb export pdf \ |
| 39 | + --layers "F.Cu,F.Silkscreen" \ |
| 40 | + --output output/front.pdf \ |
| 41 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb |
| 42 | +
|
| 43 | + kicad-cli pcb export pdf \ |
| 44 | + --layers "B.Cu,B.Silkscreen" \ |
| 45 | + --output output/back.pdf \ |
| 46 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb |
| 47 | +
|
| 48 | + kicad-cli pcb export pdf \ |
| 49 | + --layers "F.Fab,Edge.Cuts,User.1" \ |
| 50 | + --output output/fab.pdf \ |
| 51 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb |
| 52 | +
|
| 53 | + - name: Install InteractiveHtmlBom |
| 54 | + run: | |
| 55 | + git clone --depth 1 --branch v${IBOM_VERSION} https://github.com/openscopeproject/InteractiveHtmlBom |
| 56 | +
|
| 57 | + - name: Generate InteractiveHtmlBom |
| 58 | + env: |
| 59 | + INTERACTIVE_HTML_BOM_NO_DISPLAY: 1 |
| 60 | + run: | |
| 61 | + # --dest-dir is relative to the board file's directory, so use an |
| 62 | + # absolute path to land in the archived output/ at the repo root. |
| 63 | + python3 InteractiveHtmlBom/InteractiveHtmlBom/generate_interactive_bom.py \ |
| 64 | + --dest-dir "${GITHUB_WORKSPACE}/output" \ |
| 65 | + --name-format ibom \ |
| 66 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb |
| 67 | +
|
| 68 | + - name: Install KiKit |
| 69 | + run: | |
| 70 | + apt-get update && apt-get install -y python3-pip zip |
| 71 | + pip install --break-system-packages kikit==${KIKIT_VERSION} |
| 72 | +
|
| 73 | + - name: Generate JLCPCB files |
| 74 | + run: | |
| 75 | + kikit fab jlcpcb \ |
| 76 | + --assembly \ |
| 77 | + --schematic ${{ matrix.project }}/${{ matrix.project }}.kicad_sch \ |
| 78 | + --field "LCSC" \ |
| 79 | + --correctionpatterns lib/jlcpcb-kikit-corrections.csv \ |
| 80 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb \ |
| 81 | + output/jlcpcb |
| 82 | +
|
| 83 | + - name: Add stiffener (User.2) layer to JLCPCB gerbers |
| 84 | + if: matrix.project == 'pblprog-sifli-flex' |
| 85 | + run: | |
| 86 | + staging="$(mktemp -d)" |
| 87 | +
|
| 88 | + kicad-cli pcb export gerbers \ |
| 89 | + --layers User.2 \ |
| 90 | + --output "${staging}/gerber/" \ |
| 91 | + ${{ matrix.project }}/${{ matrix.project }}.kicad_pcb |
| 92 | +
|
| 93 | + # Keep only the layer gerber; drop the stray job file. |
| 94 | + rm -f "${staging}/gerber/"*.gbrjob |
| 95 | + mv "${staging}/gerber/"*-User_2.gbr \ |
| 96 | + "${staging}/gerber/${{ matrix.project }}-Stiffener.gbr" |
| 97 | +
|
| 98 | + # Fold the layer into KiKit's gerbers.zip (under its "gerber/" prefix). |
| 99 | + (cd "${staging}" && zip -r "${GITHUB_WORKSPACE}/output/jlcpcb/gerbers.zip" gerber) |
| 100 | +
|
| 101 | + - name: Archive |
| 102 | + uses: actions/upload-artifact@v7 |
| 103 | + with: |
| 104 | + name: ${{ matrix.project }}-output |
| 105 | + path: output |
| 106 | + |
| 107 | + release: |
| 108 | + needs: generate-prod-files |
| 109 | + if: startsWith(github.ref, 'refs/tags/') |
| 110 | + runs-on: ubuntu-24.04 |
| 111 | + permissions: |
| 112 | + contents: write |
| 113 | + steps: |
| 114 | + - name: Download production files |
| 115 | + uses: actions/download-artifact@v7 |
| 116 | + with: |
| 117 | + path: artifacts |
| 118 | + |
| 119 | + - name: Package production files |
| 120 | + run: | |
| 121 | + cd artifacts |
| 122 | + for dir in *-output; do |
| 123 | + project="${dir%-output}" |
| 124 | + (cd "$dir" && zip -r "../${project}-${TAG}.zip" .) |
| 125 | + done |
| 126 | + env: |
| 127 | + TAG: ${{ github.ref_name }} |
| 128 | + |
| 129 | + - name: Create GitHub release |
| 130 | + uses: softprops/action-gh-release@v2 |
| 131 | + with: |
| 132 | + files: artifacts/*.zip |
0 commit comments