forked from jakkra/ZSWatch-HW
-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (70 loc) · 2.79 KB
/
production.yml
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
name: Production
on:
pull_request:
workflow_dispatch:
pull_request_target:
types:
- closed
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: write
env:
KICAD_LIBRARY: /home/runner/work/ZSWatch-HW/ZSWatch-HW/library
strategy:
matrix:
device_type: [Watch, Sensor]
include:
- device_type: Watch
NewImage: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: .
submodules: recursive
- name: Dependencies
run: |
sudo apt update
wget https://github.com/INTI-CMNB/KiBot/releases/download/v1.7.0/kibot_1.7.0-1_all.deb
sudo apt install ./kibot*_all.deb
wget https://github.com/INTI-CMNB/InteractiveHtmlBom/releases/download/v2.9.0-1/interactivehtmlbom.inti-cmnb_2.9.0-1_all.deb
sudo apt install ./interactivehtmlbom.inti-cmnb*_all.deb
wget https://github.com/INTI-CMNB/KiAuto/releases/download/v2.3.2/kiauto_2.3.2-1_all.deb
sudo apt install ./kiauto*_all.deb
sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
sudo apt install --install-recommends kicad
git clone https://github.com/Kampi/KiCad.git library
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Initialize
run: |
mkdir -p docs/images/
mkdir -p production
- name: Generate files
run: |
cd project
kibot -g variant=${{ matrix.device_type }} -d ../production/${{ matrix.device_type }}
mkdir ../production/${{ matrix.device_type }}/ordering
mv ../production/PCBWay ../production/${{ matrix.device_type }}/ordering/PCBWay
- name: Upload Results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.device_type }}
path: |
production
if-no-files-found: ignore
- if: ${{ matrix.NewImage && (github.event.pull_request.merged == true) }}
name: Update image
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
cp production/${{ matrix.device_type }}/docs/images/PCB_Rendering.png docs/images/Image_Complete.png
git add docs/images/Image_Complete.png
git commit -m "Add image from CI/CD action"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
echo https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin ${{ github.base_ref }}