-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.14 KB
/
openscad-export.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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