Skip to content

Commit 5f29555

Browse files
SukuWcclaude
andcommitted
Add dedicated release workflow triggered on tags
- Add release_workflow.yml triggered on v* tags: runs all three builds in parallel then creates a single draft release with all artifacts - Extract _firmware_build.yml, _mechanical_build.yml, _electrical_build.yml as reusable workflows shared between nightly and release pipelines - Slim down *_workflow.yml files to thin orchestrators: check-dockerfile → build (reusable) → deploy-results/publish-nightly - firmware_workflow.yml now filters to branches only (excludes tag pushes) - Delete _firmware_release_production.yml (superseded by release_workflow) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7b60ad5 commit 5f29555

8 files changed

Lines changed: 317 additions & 311 deletions
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
dockerfile_changed:
5+
description: "Whether the electrical Dockerfile was changed"
6+
required: false
7+
type: boolean
8+
default: false
9+
10+
jobs:
11+
build:
12+
name: kicad export
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
board:
20+
- 'PCBA-KNOT'
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Prepare image
33+
run: |
34+
if [ "${{ inputs.dockerfile_changed }}" == "true" ]; then
35+
docker build -t builder:local -f docker/electrical-builder/Dockerfile .
36+
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
37+
docker tag builder:local ghcr.io/${{ github.repository_owner }}/knot-electrical-builder:latest
38+
docker push ghcr.io/${{ github.repository_owner }}/knot-electrical-builder:latest
39+
fi
40+
else
41+
docker pull ghcr.io/${{ github.repository_owner }}/knot-electrical-builder:latest
42+
docker tag ghcr.io/${{ github.repository_owner }}/knot-electrical-builder:latest builder:local
43+
fi
44+
docker run -d --name builder \
45+
-v ${{ github.workspace }}:/work \
46+
-w /work \
47+
builder:local tail -f /dev/null
48+
49+
- name: Run PCB stuff
50+
run: docker exec builder bash -c "make -C /work/Electrical/Design/${{ matrix.board }}"
51+
52+
- name: Stop container
53+
if: always()
54+
run: docker rm -f builder
55+
56+
- name: Fix file ownership
57+
if: always()
58+
run: sudo chown -R $USER ${{ github.workspace }}
59+
60+
- name: Print errors
61+
if: always()
62+
run: |
63+
cat Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-drc.html
64+
cat Electrical/Design/${{ matrix.board }}/kibot_error.log
65+
66+
- name: Set Date
67+
run: echo "action_date=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV
68+
69+
- name: Convert position file
70+
run: |
71+
python3 .github/workflows/convert_bottom_position.py ../../Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos.csv ../../Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos_fixed.csv
72+
rm Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos.csv
73+
74+
- name: Zipping gerber
75+
uses: vimtor/action-zip@v1
76+
with:
77+
files: Electrical/Design/${{ matrix.board }}/mfg-bot/JLCPCB
78+
dest: Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-gerber.zip
79+
80+
- name: Rename pdf files and removing non-zipped gerber files
81+
run: |
82+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-erc.html Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_erc.html
83+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-drc.html Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_drc.html
84+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/Schematic.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_Schematic.pdf
85+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/PCB_Top.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_PCB_Top.pdf
86+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/PCB_Bottom.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_PCB_Bottom.pdf
87+
mv Electrical/Design/${{ matrix.board }}/mfg-bot/kibot_errors.filter Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_kibot_errors.filter
88+
mv Electrical/Design/${{ matrix.board }}/kibot_error.log Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_kibot_error.log
89+
90+
rm -r Electrical/Design/${{ matrix.board }}/mfg-bot/JLCPCB
91+
92+
- name: Upload results
93+
if: always()
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: "result_${{ matrix.board }}_${{ env.action_date }}"
97+
path: |
98+
Electrical/Design/${{ matrix.board }}/mfg-bot/
99+
if-no-files-found: warn
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
dockerfile_changed:
5+
description: "Whether the firmware Dockerfile was changed"
6+
required: false
7+
type: boolean
8+
default: false
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v2
18+
with:
19+
submodules: 'recursive'
20+
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Prepare image
29+
run: |
30+
if [ "${{ inputs.dockerfile_changed }}" == "true" ]; then
31+
docker build -t ghcr.io/${{ github.repository_owner }}/knot-firmware-builder:latest -f docker/firmware-builder/Dockerfile .
32+
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
33+
docker push ghcr.io/${{ github.repository_owner }}/knot-firmware-builder:latest
34+
fi
35+
else
36+
docker pull ghcr.io/${{ github.repository_owner }}/knot-firmware-builder:latest
37+
fi
38+
39+
- name: Run script in Docker container
40+
run: docker run -v $PWD:/project -w /project/ ghcr.io/${{ github.repository_owner }}/knot-firmware-builder:latest sh -c "cd Firmware && ./esp_build_firmware.sh"
41+
42+
- name: Run Unit Tests
43+
run: |
44+
cd Firmware/components/knot_midi_translator/host_test/
45+
./test.sh
46+
./test.sh >> test.txt
47+
48+
- name: Set env
49+
shell: bash
50+
run: echo "ACTION_DATE=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV
51+
52+
- name: Copy artifact
53+
run: cp binary/midi_host_fw.uf2 knot_esp32_${{ env.ACTION_DATE }}.uf2
54+
55+
- name: Upload firmware artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: firmware
59+
path: knot_esp32_${{ env.ACTION_DATE }}.uf2

.github/workflows/_firmware_release_production.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
dockerfile_changed:
5+
description: "Whether the mechanical Dockerfile was changed"
6+
required: false
7+
type: boolean
8+
default: false
9+
10+
jobs:
11+
build:
12+
name: freecad export
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
component:
20+
- 'KNOT-FRONT'
21+
- 'KNOT-BACK'
22+
- 'KNOT-HOUSING'
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Prepare image
36+
run: |
37+
if [ "${{ inputs.dockerfile_changed }}" == "true" ]; then
38+
docker build -t builder:local -f docker/mechanical-builder/Dockerfile .
39+
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
40+
docker tag builder:local ghcr.io/${{ github.repository_owner }}/knot-mechanical-builder:latest
41+
docker push ghcr.io/${{ github.repository_owner }}/knot-mechanical-builder:latest
42+
fi
43+
else
44+
docker pull ghcr.io/${{ github.repository_owner }}/knot-mechanical-builder:latest
45+
docker tag ghcr.io/${{ github.repository_owner }}/knot-mechanical-builder:latest builder:local
46+
fi
47+
docker run -d --name builder \
48+
-v ${{ github.workspace }}:/work \
49+
-w /work \
50+
builder:local tail -f /dev/null
51+
52+
- name: Start virtual display
53+
run: |
54+
docker exec builder bash -c "
55+
Xvfb :99 -screen 0 1920x1080x24 > /dev/null 2>&1 &
56+
until xdpyinfo -display :99 > /dev/null 2>&1; do sleep 0.5; done
57+
x11vnc -display :99 -nopw -listen localhost -xkb -ncache 10 -ncache_cr -forever > /dev/null 2>&1 &
58+
"
59+
60+
- name: Run GUI application
61+
continue-on-error: true
62+
run: |
63+
docker exec -e DISPLAY=:99 builder bash -c "
64+
freecad --hidden /work/Mechanical/Design/${{ matrix.component }}/${{ matrix.component }}.FCStd /work/.github/workflows/freecad_export.py step pdf || true
65+
"
66+
67+
- name: Convert STEP to STL
68+
run: docker exec builder /opt/conda/envs/occenv/bin/python /work/.github/workflows/pythonocc_step_to_stl.py
69+
70+
- name: Generate Preview PNG
71+
run: docker exec builder bash -c "/work/.github/workflows/openscad_preview.sh"
72+
73+
- name: Copy reference files
74+
run: |
75+
docker exec builder bash -c "
76+
find /work/Mechanical/Design/${{ matrix.component }}/ -maxdepth 1 -name '${{ matrix.component }}*' ! -name '*.FCStd' ! -name '*.FCBak' -exec cp {} /work/temp/ \; || true
77+
"
78+
79+
- name: Stop container
80+
if: always()
81+
run: docker rm -f builder
82+
83+
- name: Fix file ownership
84+
if: always()
85+
run: sudo chown -R $USER ${{ github.workspace }}
86+
87+
- name: Set Date
88+
run: echo "action_date=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV
89+
90+
- name: Upload artifacts
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: "result_${{ matrix.component }}_${{ env.action_date }}"
94+
path: temp/${{ matrix.component }}*.*

0 commit comments

Comments
 (0)