-
Notifications
You must be signed in to change notification settings - Fork 29
115 lines (86 loc) · 3.3 KB
/
create-board.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Create Board
on:
workflow_call:
inputs:
token:
description: 'Token for accessing private repos'
required: false
type: string
jobs:
create-board:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: clone hellen-one if needed
run: |
if [ -d hellen-one ]; then
echo Found hellen-one
else
git clone https://github.com/andreika-git/hellen-one
ls -l hellen-one
cd hellen-one
git submodule update --init
fi
- name: Install kicad 8
run: |
sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
sudo apt-get install kicad
pip install kicad-netlist-reader
- name: Generate Gerber Files
run: |
bash hellen-one/kicad/bin/export.sh
- name: git pull
run: git pull
- name: Commit fresh gerber files
# sad: copy-pasta see below! TODO reuse somehow?
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
git diff --name-only | while read f; do
if [ $(git diff --color=always|perl -wlne 'print $1 if /^\e\[32m\+\e\[m\e\[32m(.*)\e\[m$/' "$f" | grep -vE "Created|Generation|[dD]ate" | wc -l) -eq 0 ]; then
echo Only unimportant changes here? NOT SURE not invoking git checkout "$f"
fi
done
bash hellen-one/bin/gha-commit.sh
- name: git pull
run: git pull
- name: Push gerber files
# sad: copy-pasta see below! TODO reuse somehow?
# let's support both newer 'main' and older 'master' repositories
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && env.NOCOMMIT != 'true'}}
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ steps.extract_branch.outputs.branch }}
- name: 1. Build Docker
run: |
bash hellen-one/bin/step1_build_hellen-one_docker.sh
- name: 2. Copy
run: |
bash hellen-one/bin/step2_copy_with_docker.sh
- name: 3. Create Board
run: |
bash hellen-one/bin/step3_create_board_with_docker.sh
- name: git pull
run: git pull
- name: Commit fresh board files
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
git diff --name-only | while read f; do
if [ $(git diff --color=always|perl -wlne 'print $1 if /^\e\[32m\+\e\[m\e\[32m(.*)\e\[m$/' "$f" | grep -vE "Created|Generation|[dD]ate" | wc -l) -eq 0 ]; then
echo Only unimportant changes here? NOT SURE not invoking git checkout "$f"
fi
done
bash hellen-one/bin/gha-commit.sh
- name: git pull
run: git pull
- name: Push board files
# let's support both newer 'main' and older 'master' repositories
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && env.NOCOMMIT != 'true'}}
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ steps.extract_branch.outputs.branch }}