WIP #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Production | |
on: | |
pull_request: | |
workflow_dispatch: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/inti-cmnb/kicad8_auto_full:latest | |
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: git clone https://github.com/Kampi/KiCad.git library | |
- name: Extract branch name | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- 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 | |
- name: Update image Test | |
if: ${{ matrix.NewImage && (github.event.pull_request.merged == true) }} | |
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 }} | |
git push origin ${{ github.base_ref }} |