-
Notifications
You must be signed in to change notification settings - Fork 216
88 lines (76 loc) · 2.8 KB
/
pcb-artifacts-module440.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
name: pcb-artifacts-module440
on:
push:
paths:
- 'ModuleV440/**.sch'
- 'ModuleV440/**.kicad_pcb'
- '.github/workflows/pcb-artifacts-module440.yaml'
- 'ModuleV440/module440-config-2layer.kibot.yaml'
pull_request:
paths:
- 'ModuleV440/**.sch'
- 'ModuleV440/**.kicad_pcb'
- '.github/workflows/pcb-artifacts-module440.yaml'
- 'ModuleV440/module440-config-2layer.kibot.yaml'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
repo: stuartpittaway/diyBMSv4
main_branch: master
jobs:
generate-artifacts:
runs-on: ubuntu-latest
container: setsoft/kicad_auto:latest
steps:
- name: Update system repositories, Install Required Libraries and Initialize git-lfs
run: |
apt update
apt -y install git git-lfs zip librsvg2-bin imagemagick
git lfs install
- name: Checkout Repository
uses: actions/checkout@v2
with:
lfs: true
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Update the PCBs with on default branch with git hash
if: steps.extract_branch.outputs.branch == env.main_branch
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
echo "ref: ${{ github.ref }}"
echo "default: ${{ env.default }}"
sed -i "s!<<hash>>!${COMMIT}!" ModuleV440/ModuleV440.kicad_pcb
- name: Update the PCBs with the git hash and BETA.
if: steps.extract_branch.outputs.branch != env.main_branch
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
sed -i "s!<<hash>>!BETA-${COMMIT}!" ModuleV440/ModuleV440.kicad_pcb
- name: Prepare artifacts
run: |
cd ModuleV440
rm -rf export/
kibot -c module440-config-2layer.kibot.yaml -e ModuleV440.sch -b ModuleV440.kicad_pcb -d export
# Splitting this out to ensure a failed kibot run will mark a check as failed.
- name: Prepare Gerbers artifact
run: |
cd ModuleV440/export/gerbers
zip -r -j ../modulev440_gerbers.zip *
- name: upload artifacts
uses: actions/upload-artifact@v2
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.repository != env.repo)
with:
name: modulev440_gerbers
path: ModuleV440/export/modulev440_gerbers.zip
- name: Commit files
if: github.event_name == 'push' && github.repository == env.repo
run: |
git add -f ModuleV440/export
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git status
git commit -m "CI: pcb-artifacts-module440"
git push -u origin