diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml new file mode 100644 index 0000000..92115be --- /dev/null +++ b/.github/workflows/render.yml @@ -0,0 +1,156 @@ +name: render +on: push +jobs: + render: + runs-on: ubuntu-22.04 + steps: + + - name: download ninja binary + run: curl -LO https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip + + - name: extract ninja binary + run: unzip ninja-linux.zip + + - name: install ninja + run: sudo install ninja /usr/local/bin/ + + - name: update system + run: sudo apt-get update + + - name: install openscad + run: sudo apt-get install -y --no-install-recommends openscad xvfb + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: render 3mf + run: ninja a5-stop.3mf + + - name: add commit hash to 3mf filename + run: mv a5-stop.3mf a5-stop_${{ github.sha }}.3mf + + - name: upload 3mf + uses: actions/upload-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.3mf + path: a5-stop_${{ github.sha }}.3mf + + - name: render stl + run: ninja a5-stop.stl + + - name: add commit hash to stl filename + run: mv a5-stop.stl a5-stop_${{ github.sha }}.stl + + - name: upload stl + uses: actions/upload-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.stl + path: a5-stop_${{ github.sha }}.stl + + - name: render png + uses: coactions/setup-xvfb@v1 + with: + run: ninja a5-stop.png + + - name: add commit hash to png filename + run: mv a5-stop.png a5-stop_${{ github.sha }}.png + + - name: upload png + uses: actions/upload-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.png + path: a5-stop_${{ github.sha }}.png + + github-release: + needs: render + runs-on: ubuntu-22.04 + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + steps: + + - name: calculate new version + uses: frabert/replace-string-action@v1.1 + with: + string: ${{ github.ref }} + pattern: 'refs/tags/v' + replace-with: '' + id: version + + - name: download 3mf + uses: actions/download-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.3mf + + - name: download stl + uses: actions/download-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.stl + + - name: create github release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body: | + ![2d render](https://qguv.github.io/a5-stop/img/a5-stop_${{ steps.version.outputs.replaced }}.png) + tag_name: ${{ github.ref }} + release_name: Release ${{ steps.version.outputs.replaced }} + draft: true + prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }} + id: create_release + + - name: upload 3mf as a release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: a5-stop_${{ github.sha }}.3mf + asset_name: a5-stop_${{ steps.version.outputs.replaced }}.3mf + asset_content_type: application/octet-stream + + - name: upload stl as a release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: a5-stop_${{ github.sha }}.stl + asset_name: a5-stop_${{ steps.version.outputs.replaced }}.stl + asset_content_type: application/octet-stream + + gh-pages-release: + needs: render + runs-on: ubuntu-22.04 + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + steps: + + - name: calculate new version + uses: frabert/replace-string-action@v1.1 + with: + string: ${{ github.ref }} + pattern: 'refs/tags/v' + replace-with: '' + id: version + + - uses: actions/download-artifact@v2 + with: + name: a5-stop_${{ github.sha }}.png + + - name: upload rendered image + run: | + mkdir -p gh-pages/img + cp a5-stop_${{ github.sha }}.png gh-pages/img/a5-stop.png + cp a5-stop_${{ github.sha }}.png gh-pages/img/a5-stop_${{ steps.version.outputs.replaced }}.png + + - name: deploy to github pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: gh-pages/ + keep_files: true + enable_jekyll: false diff --git a/.gitignore b/.gitignore index c511f92..aba5293 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .ninja_log -pillstack.3mf +*.3mf +*.stl +*.png diff --git a/BOSL2 b/BOSL2 deleted file mode 160000 index 46f7835..0000000 --- a/BOSL2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46f7835dbf0935373192ef0d8c7d5176eb87f304 diff --git a/README.md b/README.md index a78bcb6..4a4530b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ # a5 alignment stop -A5 alignment stop for the Dahle 507 paper cutter +![3d render of object](https://qguv.github.io/a5-stop/img/a5-stop.png) -## building - -once you have the submodules (`git submodule update --init`), run `ninja` or `openscad -o a5.3mf a5.scad` +Customizable, 3d-printable A5 alignment stop for the Dahle 507 paper cutter. -## animation - -some animations are included at the beginning of pillstack.scad. you can uncomment them (one at a time) to view them. from the OpenSCAD GUI, select View → Animate, then set FPS to 30 and Steps to 360 +## building -note: this seems to prevent OpenSCAD from automatically updating the preview when the source changes +Once you have the submodules (`git submodule update --init`), run `ninja` or `openscad -o pillstack.3mf pillstack.scad` diff --git a/a5-stop.scad b/a5-stop.scad index 0386a72..336d0a2 100644 --- a/a5-stop.scad +++ b/a5-stop.scad @@ -1,10 +1,3 @@ -// animation: fix camera in place -//$vpr = [$vpr[0], 0, $vpr[2]]; -//$vpt = [0, 0, 0]; - -// animation: spin -//$vpr = [$vpr[0], 0, 360 * $t]; - include $fn = 90; @@ -60,4 +53,4 @@ module all() { } } -all(); \ No newline at end of file +all(); diff --git a/build.ninja b/build.ninja index 10b8eeb..9dff73b 100644 --- a/build.ninja +++ b/build.ninja @@ -1,4 +1,9 @@ -rule openscad +rule render3d command = openscad -o $out $in -build a5-stop.3mf: openscad a5-stop.scad +rule render2d + command = openscad --colorscheme BeforeDawn -o $out $in + +build a5-stop.3mf: render3d a5-stop.scad +build a5-stop.stl: render3d a5-stop.scad +build a5-stop.png: render2d a5-stop.scad