diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ebf86c9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +name: CI +on: + push: + branches: [ main ] +jobs: + build-web: + runs-on: ubuntu-latest + container: + image: ghcr.io/slintak/kicad-builder:latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Everything + run: make + + - name: Upload Fabrication Files + uses: actions/upload-artifact@v4 + with: + name: build-fabrication + path: build/web/files/ + if-no-files-found: error + + - name: Upload Web Files + uses: actions/upload-artifact@v4 + with: + name: build-web + path: build/web/ + if-no-files-found: error + + # Deploy job + deploy: + # Add a dependency to the build job + needs: [build-web] + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Get Web Files + uses: actions/download-artifact@v4 + with: + name: build-web + path: build/ + + - name: Upload Pages Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build/ + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/Makefile b/Makefile index c4b2f0c..ba71426 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,12 @@ fabrication: $(BOARD).kicad_pcb $(BOARD).kicad_sch $(GERBER_ZIPS) # kicad-cli pcb export pos $< --side front --format csv --units mm -o $(TEMPLATE_FAB_DIR)/$(BOARD)_top_pos.csv sed -e '1 s/Ref/Designator/' -e '1 s/PosX/Mid X/' -e '1 s/PosY/Mid Y/' -e '1 s/Rot/Rotation/' -e '1 s/Side/Layer/' $(TEMPLATE_FAB_DIR)/$(BOARD)_top_pos.csv > $(TEMPLATE_FAB_DIR)/$(BOARD)_pos_jlcpcb.csv - kicad-cli pcb export step --subst-models $< -o $(TEMPLATE_FAB_DIR)/$(BOARD)_model.step - xz -f $(TEMPLATE_FAB_DIR)/$(BOARD)_model.step - touch $(TEMPLATE_FAB_DIR) + kicad-cli pcb export step --subst-models $< -o $(TEMPLATE_FAB_DIR)/$(BOARD)_model.step ; \ + rc=$$?; if [ $$rc -ne 0 ] && [ $$rc -ne 2 ]; then exit $$rc; fi + kicad-cli pcb export vrml $< -o $(TEMPLATE_FAB_DIR)/$(BOARD)_model.vrml + @xz -f $(TEMPLATE_FAB_DIR)/$(BOARD)_model.step + @xz -f $(TEMPLATE_FAB_DIR)/$(BOARD)_model.vrml + @touch $(TEMPLATE_FAB_DIR) render: $(BOARD).kicad_pcb @mkdir -p $(TEMPLATE_RENDER_DIR) @@ -61,10 +64,10 @@ build/%.html: %.md build/%.html.j2: present/template/%.html.j2 @mkdir -p build - cp $< $@ + @cp $< $@ build/%.json: present/template/%.json - cp $< $@ + @cp $< $@ build/web/%.html: build/%.html.j2 build/%.json build/README.html @mkdir -p build/web diff --git a/present/template/index.json b/present/template/index.json index 3c87125..0012bfc 100644 --- a/present/template/index.json +++ b/present/template/index.json @@ -11,7 +11,8 @@ {"file": "linht-hw_bom.xml", "description": "Bill of Materials (XML)"}, {"file": "linht-hw_schematic.pdf", "description": "Schematic (PDF)"}, {"file": "linht-hw_schematic_bw.pdf", "description": "Schematic without Colors (PDF)"}, - {"file": "linht-hw_model.step.xz", "description": "3D Model (STEP.XZ)"} + {"file": "linht-hw_model.step.xz", "description": "3D Model (STEP.XZ)"}, + {"file": "linht-hw_model.vrml.xz", "description": "3D Model (VRML.XZ)"} ], "renders": [ {"suffix": "preview", "alt": "Isometric view of the PCB"},