-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (129 loc) · 4.52 KB
/
render.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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