1
- name : OpenSCAD Export to STL
1
+ name : OpenSCAD Export to STL and Auto-Tag
2
2
3
3
on :
4
4
push :
5
5
branches : [ main ]
6
- pull_request :
7
- branches : [ main ]
8
6
workflow_dispatch :
9
7
10
8
jobs :
11
- export-stl :
9
+ export-stl-and-tag :
12
10
runs-on : ubuntu-latest
11
+ permissions :
12
+ contents : write
13
+ actions : read
13
14
steps :
14
15
- uses : actions/checkout@v2
16
+ with :
17
+ fetch-depth : 0 # Fetch all history for all tags and branches
15
18
16
19
- name : Install OpenSCAD
17
20
run : |
@@ -29,26 +32,29 @@ jobs:
29
32
run : |
30
33
cat stl_files/*.stl > combined.stl
31
34
32
- - name : Upload individual STL files
33
- uses : actions/upload-artifact@v2
34
- with :
35
- name : stl-files
36
- path : stl_files/*.stl
35
+ - name : Generate new tag
36
+ id : tag_version
37
+ run : |
38
+ git fetch --tags
39
+ latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
40
+ new_tag=$(echo $latest_tag | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
41
+ echo "NEW_TAG=$new_tag" >> $GITHUB_OUTPUT
37
42
38
- - name : Upload combined STL file
39
- uses : actions/upload-artifact@v2
40
- with :
41
- name : combined-stl
42
- path : combined.stl
43
+ - name : Create and push tag
44
+ run : |
45
+ git config user.name github-actions
46
+ git config user.email [email protected]
47
+ git tag ${{ steps.tag_version.outputs.NEW_TAG }}
48
+ git push origin ${{ steps.tag_version.outputs.NEW_TAG }}
43
49
44
50
- name : Create Release
45
51
id : create_release
46
52
uses : actions/create-release@v1
47
53
env :
48
54
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49
55
with :
50
- tag_name : ${{ github.ref }}
51
- release_name : Release ${{ github.ref }}
56
+ tag_name : ${{ steps.tag_version.outputs.NEW_TAG }}
57
+ release_name : Release ${{ steps.tag_version.outputs.NEW_TAG }}
52
58
draft : false
53
59
prerelease : false
54
60
62
68
asset_name : combined.stl
63
69
asset_content_type : model/stl
64
70
71
+ - name : Upload individual STL files
72
+ uses : actions/upload-artifact@v2
73
+ with :
74
+ name : stl-files
75
+ path : stl_files/*.stl
76
+
77
+ - name : Upload combined STL file
78
+ uses : actions/upload-artifact@v2
79
+ with :
80
+ name : combined-stl
81
+ path : combined.stl
82
+
0 commit comments