From 0a67fb4d041cac5184e377cfd2fe8cf69a93acd1 Mon Sep 17 00:00:00 2001 From: Gabriel Koppenstein <82903393+gab-k@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:02:40 +0100 Subject: [PATCH] Create pcb_render.yml --- .github/workflows/pcb_render.yml | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/pcb_render.yml diff --git a/.github/workflows/pcb_render.yml b/.github/workflows/pcb_render.yml new file mode 100644 index 0000000..a40bdc7 --- /dev/null +++ b/.github/workflows/pcb_render.yml @@ -0,0 +1,70 @@ +name: pcb_image +on: + push: + branches: + - dev # Trigger on push to 'dev' branch + - main # Trigger on push to 'main' branch + paths: + - '.github/workflows/pcb_render.yml' # Trigger if this workflow file changes + - 'KiCad/**' # Trigger if any file in the 'KiCad' directory changes + +jobs: + render-image: + name: render-image + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Render PCB image + uses: linalinn/kicad-render@main + with: + pcb_file: KiCad/RP2040-Decoder.kicad_pcb + output_path: ${{ github.workspace }}/images + animation: gif + + - name: Upload images as artifact + uses: actions/upload-artifact@v4 + with: + name: pcb-images + path: images/ + + deploy-pages-main: + if: github.ref == 'refs/heads/main' # Only deploy on 'main' branch + runs-on: ubuntu-latest + needs: render-image + + steps: + - name: Download pcb-images artifact + uses: actions/download-artifact@v4 + with: + name: pcb-images + path: images/ + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./images + publish_branch: gh-pages # Specify the target branch (gh-pages in this case) + destination_dir: img + + deploy-pages-dev: + if: github.ref == 'refs/heads/dev' # Only deploy on 'dev' branch + runs-on: ubuntu-latest + needs: render-image + + steps: + - name: Download pcb-images artifact + uses: actions/download-artifact@v4 + with: + name: pcb-images + path: images/ + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./images + publish_branch: gh-pages-dev # Specify the target branch (gh-pages-dev in this case) + destination_dir: img