From 9da3776cf5e29965295f5f55a244425276197c7c Mon Sep 17 00:00:00 2001 From: Dominik Helfenstein Date: Mon, 24 Jun 2024 22:44:21 +0200 Subject: [PATCH] feat: github actions --- .github/workflows/openscad-export.yml | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/openscad-export.yml diff --git a/.github/workflows/openscad-export.yml b/.github/workflows/openscad-export.yml new file mode 100644 index 0000000..bdecb3a --- /dev/null +++ b/.github/workflows/openscad-export.yml @@ -0,0 +1,75 @@ +name: OpenSCAD Export to STL + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + export-stl: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Cache OpenSCAD + uses: actions/cache@v2 + with: + path: ~/.local/share/OpenSCAD + key: ${{ runner.os }}-openscad-${{ hashFiles('**/lockfiles') }} + restore-keys: | + ${{ runner.os }}-openscad- + + - name: Install OpenSCAD + if: steps.cache-openscad.outputs.cache-hit != 'true' + run: | + sudo add-apt-repository ppa:openscad/releases + sudo apt-get update + sudo apt-get install openscad + + - name: Export SCAD to STL + run: | + mkdir stl_files + for file in *.scad + do + openscad -o stl_files/${file%.scad}.stl --export-format binstl -D '$fn=200' $file + done + + - name: Create combined STL + run: | + cat stl_files/*.stl > combined.stl + + - name: Upload individual STL files + uses: actions/upload-artifact@v2 + with: + name: stl-files + path: stl_files/*.stl + + - name: Upload combined STL file + uses: actions/upload-artifact@v2 + with: + name: combined-stl + path: combined.stl + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./combined.stl + asset_name: combined.stl + asset_content_type: model/stl +