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

116 lines
3.3 KiB
YAML

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
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 }}