KiBot #7
This file contains hidden or 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: KiBot | |
| # Controls when the action will run. | |
| on: | |
| push: | |
| paths: | |
| - "board/output/pcbs/*.kicad_sch" | |
| - "board/output/pcbs/*.kicad_pcb" | |
| - "board/*.kibot.yaml" | |
| - ".github/workflows/kibot.yml" | |
| tags: | |
| - "v*.*.*" | |
| pull_request: | |
| paths: | |
| - "board/output/pcbs/*.kicad_sch" | |
| - "board/output/pcbs/*.kicad_pcb" | |
| - "board/*.kibot.yaml" | |
| - ".github/workflows/kibot.yml" | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| KIBOT: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-kibot-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-kibot- | |
| - name: Cache KiBot Docker image | |
| id: cache-kibot | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/kibot-image.tar | |
| key: kibot-v2_dk9-${{ hashFiles('.github/workflows/kibot.yml') }} | |
| - name: Load cached Docker image | |
| if: steps.cache-kibot.outputs.cache-hit == 'true' | |
| run: | | |
| docker load -i /tmp/kibot-image.tar || true | |
| - name: Pre-pull and save KiBot image | |
| if: steps.cache-kibot.outputs.cache-hit != 'true' | |
| run: | | |
| docker pull ghcr.io/inti-cmnb/kibot:v2_dk9 | |
| docker save ghcr.io/inti-cmnb/kibot:v2_dk9 -o /tmp/kibot-image.tar | |
| - name: Create dummy schematic if needed | |
| run: | | |
| if [ ! -f "board/output/pcbs/sessile.kicad_sch" ]; then | |
| touch board/output/pcbs/sessile.kicad_sch | |
| echo '(kicad_sch (version 20230121))' > board/output/pcbs/sessile.kicad_sch | |
| fi | |
| - uses: INTI-CMNB/KiBot@v2_dk9 | |
| with: | |
| config: board/sessile.kibot.yaml | |
| dir: board/output/pcbs | |
| # variant: board | |
| board: board/output/pcbs/sessile.kicad_pcb | |
| schema: board/output/pcbs/sessile.kicad_sch | |
| skip: erc | |
| targets: ZIP_ASSEMBLY | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pcb | |
| path: board/output/pcbs/jlcpcb.zip | |
| release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| needs: KIBOT | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: pcb | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: "jlcpcb.zip" |