re: reduce quality, improve export speed #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OpenSCAD Export to STL and Auto-Tag | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
export-stl-and-tag: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: read | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install OpenSCAD | |
run: | | |
sudo snap 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=80' $file | |
done | |
- name: Zip STL files | |
run: | | |
zip -j combined.zip stl_files/*.stl | |
- name: Generate new tag | |
id: tag_version | |
run: | | |
git fetch --tags | |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
new_tag=$(echo $latest_tag | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | |
echo "NEW_TAG=$new_tag" >> $GITHUB_OUTPUT | |
- name: Create and push tag | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git tag ${{ steps.tag_version.outputs.NEW_TAG }} | |
git push origin ${{ steps.tag_version.outputs.NEW_TAG }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag_version.outputs.NEW_TAG }} | |
release_name: Release ${{ steps.tag_version.outputs.NEW_TAG }} | |
draft: false | |
prerelease: false | |
- name: Upload Combined ZIP | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./combined.zip | |
asset_name: combined.zip | |
asset_content_type: application/zip | |
- name: Upload Individual STL Files | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: stl_files/*.stl | |
tag: ${{ steps.tag_version.outputs.NEW_TAG }} | |
overwrite: true | |
file_glob: true | |