hellen-one/.github/workflows/create-board.yaml

116 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2023-07-12 19:31:31 -07:00
name: Create Board
on:
2023-07-12 21:06:57 -07:00
workflow_call:
inputs:
token:
2023-07-12 21:26:19 -07:00
description: 'Token for accessing private repos'
2023-07-12 21:06:57 -07:00
required: false
type: string
2023-07-12 19:31:31 -07:00
jobs:
create-board:
runs-on: ubuntu-latest
steps:
2023-07-12 21:26:19 -07:00
2023-12-10 18:05:10 -08:00
- uses: actions/checkout@v4
2023-07-12 19:31:31 -07:00
with:
submodules: recursive
2024-01-11 21:42:46 -08:00
- 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
2024-01-21 15:40:17 -08:00
cd hellen-one
git submodule update --init
2024-01-11 21:42:46 -08:00
fi
2024-06-14 21:20:53 -07:00
- name: Install kicad 8
2023-07-12 19:31:31 -07:00
run: |
sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
2023-07-12 19:31:31 -07:00
sudo apt-get install kicad
pip install kicad-netlist-reader
- name: Generate Gerber Files
run: |
2023-07-12 20:49:03 -07:00
bash hellen-one/kicad/bin/export.sh
2023-07-12 19:31:31 -07:00
2023-11-06 06:33:28 -08:00
- name: git pull
run: git pull
2023-09-07 18:06:13 -07:00
- 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"
2023-09-07 18:06:13 -07:00
fi
done
bash hellen-one/bin/gha-commit.sh
2023-11-06 06:33:28 -08:00
- name: git pull
run: git pull
2023-09-07 18:06:13 -07:00
- 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 }}
2023-07-12 19:31:31 -07:00
- 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
2023-11-06 06:33:28 -08:00
- name: git pull
run: git pull
2023-07-12 19:31:31 -07:00
- 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
2023-07-12 19:31:31 -07:00
bash hellen-one/bin/gha-commit.sh
2023-11-06 06:33:28 -08:00
- name: git pull
run: git pull
2023-07-12 19:31:31 -07:00
- 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 }}