Skip to content

Commit

Permalink
Merge pull request #2 from BenMMcLean/mclean/feature/position-file-ex…
Browse files Browse the repository at this point in the history
…port

Add position file option
  • Loading branch information
emilymclean authored Oct 4, 2024
2 parents 43817bb + a331fab commit 7404442
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
showConfig: true
configFilePath: ./gitversion.yml
- name: Display SemVer
run: |
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
pull_request:
push:
branches: [ master, main, develop ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: FPGAwars/icezum
ref: dbad423670419b82018bf6e33c418fc35558c1be
path: proj
- name: Render template
id: render_template
uses: chuhlomin/render-template@v1
with:
template: action.template.yml
result_path: action.yml
vars: |
image: Dockerfile
- uses: ./
with:
input-file: proj/src-kicad/icezum.kicad_pcb
output-directory: out
position-format: gerber
- uses: actions/upload-artifact@v4
with:
name: test-gerber
path: out/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Generates gerber & drill files for a specified PCB and places them in a specifie

The directory in which to place the gerber & drill files. Default "gerber".

### `position-format`

The position format to use. Options are gerber, csv, ascii, and none. Default "none".

## Example usage
```
uses: BenMMcLean/KicadGerber@v1
Expand Down
5 changes: 5 additions & 0 deletions action.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ inputs:
description: 'The directory in which to place the output'
required: false
default: "gerber"
position-format:
description: 'The position format to use. Options are gerber, csv, ascii, and none'
required: false
default: "none"
runs:
using: 'docker'
image: '{{ .image }}'
args:
- ${{`{{ inputs.input-file }}`}}
- ${{`{{ inputs.output-directory }}`}}
- ${{`{{ inputs.position-format }}`}}
branding:
icon: 'cpu'
color: 'green'
21 changes: 17 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/bin/sh -l
#!/bin/bash

mkdir -p /github/workspace/$2
kicad-cli pcb export drill -o /github/workspace/$2 /github/workspace/$1
kicad-cli pcb export gerbers -o /github/workspace/$2 /github/workspace/$1
output="/github/workspace/$2"
input="/github/workspace/$1"
placement_format="${3:-ascii}"

filename="$(basename -- "$input" .${input##*.})"

mkdir -p "$output"
kicad-cli pcb export drill -o "$output" "$input"
kicad-cli pcb export gerbers -o "$output" "$input"

if [[ "$placement_format" == "ascii" || "$placement_format" == "csv" ]]; then
kicad-cli pcb export pos --format "$placement_format" -o "$output" "$input"
elif [[ "$placement_format" == "gerber" ]]; then
kicad-cli pcb export pos --format gerber --side front -o "$output/$filename.front.pos" "$input"
kicad-cli pcb export pos --format gerber --side back -o "$output/$filename.back.pos" "$input"
fi

0 comments on commit 7404442

Please sign in to comment.