|
| 1 | +name: Production-DevKit |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request_target: |
| 7 | + types: |
| 8 | + - closed |
| 9 | + |
| 10 | +jobs: |
| 11 | + generate: |
| 12 | + name: Generate production data |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: ghcr.io/inti-cmnb/kicad9_auto_full:latest |
| 15 | + |
| 16 | + env: |
| 17 | + MOUSER_KEY: ${{ secrets.MOUSER_KEY }} |
| 18 | + KICAD_LIBRARY: /home/runner/work/ZSWatch-HW/ZSWatch-HW/Kicad-Lib |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + device_type: [DevKit] |
| 23 | + include: |
| 24 | + - device_type: DevKit |
| 25 | + NewImage: 1 |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + path: . |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + - name: Cache KiCost data |
| 35 | + uses: actions/cache@v3 |
| 36 | + with: |
| 37 | + path: ~/kicost_cache |
| 38 | + key: kicost_cache |
| 39 | + |
| 40 | + - name: Dependencies |
| 41 | + run: | |
| 42 | + git clone https://github.com/Kampi/KiCad.git Kicad-Lib |
| 43 | +
|
| 44 | + - name: Extract branch name |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Initialize |
| 50 | + run: | |
| 51 | + mkdir -p log |
| 52 | + mkdir -p docs/images |
| 53 | + mkdir -p production |
| 54 | +
|
| 55 | + - name: Generate files |
| 56 | + run: | |
| 57 | + cd dev-kit |
| 58 | + kibot -vvvv -g variant=${{ matrix.device_type }} -d ../production/${{ matrix.device_type }} 2> ../log/kibot.log |
| 59 | + mkdir ../production/${{ matrix.device_type }}/ordering |
| 60 | +
|
| 61 | + - name: Clean up |
| 62 | + run: | |
| 63 | + cd production/${{ matrix.device_type }} |
| 64 | + find . -type f -iname \*.log -delete |
| 65 | + find . -type f -iname \*.ogv -delete |
| 66 | +
|
| 67 | + - name: Upload logs |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + if: ${{ always() }} |
| 70 | + with: |
| 71 | + name: Log-${{ matrix.device_type }} |
| 72 | + path: log |
| 73 | + |
| 74 | + - name: Upload Results |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: ${{ matrix.device_type }} |
| 78 | + path: production |
| 79 | + if-no-files-found: ignore |
| 80 | + |
| 81 | + - if: ${{ matrix.NewImage }} |
| 82 | + name: Update image |
| 83 | + run: | |
| 84 | + git config --local user.name "github-actions[bot]" |
| 85 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 86 | + cp production/${{ matrix.device_type }}/docs/images/PCB_Rendering.png docs/images/Image_Complete.png |
| 87 | + git add docs/images/Image_Complete.png |
| 88 | + git commit -m "Add image from CI/CD action" |
| 89 | + git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} |
| 90 | + echo https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} |
| 91 | + git push origin ${{ github.base_ref }} |
0 commit comments