name: 'Export Gerbers'
description: 'Export Gerber files from a Kicad PCB'
inputs:
  boards:
    description: 'Board name'
    required: true
  fab:
    description: 'Fabrication profile'
    default: 'jlcpcb'
  flags:
    description: 'Additional flags for kikit fab'
    default: '--no-assembly'
runs:
  using: 'docker'
  image: 'docker://yaqwsx/kikit:latest:latest'
  entrypoint: '/bin/sh'
  args:
    - '-c'
    - |
      for board in ${{ inputs.boards }};
      do
        echo Processing $board
        mkdir -p $GITHUB_WORKSPACE/output/gerbers/${board} ;
        kikit fab ${{ inputs.fab }} ${{ inputs.flags }} $GITHUB_WORKSPACE/output/pcbs/${board}_routed.kicad_pcb $GITHUB_WORKSPACE/output/gerbers/${board}
      done
