-
-
Notifications
You must be signed in to change notification settings - Fork 17
238 lines (229 loc) · 7.89 KB
/
build.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Build
on:
push:
tags:
- v**
jobs:
build-frontend:
name: Build snd-frontend
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install Frontend Dependencies
working-directory: frontend
run: npm ci
- name: Build Frontend
working-directory: frontend
run: npm run build
- name: Archive Frontend
uses: actions/upload-artifact@v4
with:
name: snd-frontend
path: frontend/dist
if-no-files-found: error
build-linux-app:
name: Build ${{ matrix.artifact-name }}
runs-on: ubuntu-latest
needs: build-frontend
strategy:
matrix:
include:
# ELECTRON
- arch: "amd64"
tags: "ELECTRON"
artifact-name: "snd-linux-amd64-gui"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-linux-amd64-gui-libusb"
# HEADLESS
- arch: "amd64"
artifact-name: "snd-linux-amd64-headless"
- arch: "arm64"
artifact-name: "snd-linux-arm64-headless"
- arch: "386"
artifact-name: "snd-linux-i386-headless"
- arch: "arm"
armv: "5"
artifact-name: "snd-linux-armv5-headless"
- arch: "arm"
armv: "6"
artifact-name: "snd-linux-armv6-headless"
- arch: "arm"
armv: "7"
artifact-name: "snd-linux-armv7-headless"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: sudo apt-get install libusb-1.0-0-dev pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: linux
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
build-windows-app:
name: Build ${{ matrix.artifact-name }}
runs-on: windows-latest
needs: build-frontend
strategy:
matrix:
include:
# ELECTRON
- arch: "amd64"
libusb: false
tags: "ELECTRON"
artifact-name: "snd-windows"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-windows-libusb"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Prepare libusb
if: matrix.libusb
uses: msys2/setup-msys2@v2
with:
path-type: inherit # needs access to other executables like go
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-pkg-config mingw-w64-x86_64-libusb
- name: Check for libusb
if: matrix.libusb
shell: msys2 {0}
run: |
pkg-config --cflags libusb-1.0
pkg-config --libs libusb-1.0
ls D:/a/_temp/msys64/mingw64/bin/libusb-1.0.dll
- name: Build App
uses: ./.github/actions/build-app
with:
os: windows
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
libusb-path: ${{ matrix.libusb && 'D:/a/_temp/msys64/mingw64/bin/libusb-1.0.dll' || null }}
# macOS AMD64
build-darwin-amd64-app:
name: Build ${{ matrix.artifact-name }}
runs-on: macos-12
needs: build-frontend
strategy:
matrix:
include:
- arch: "amd64"
tags: "ELECTRON"
artifact-name: "snd-macos-intel"
mac-app-bundle: "true"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-macos-intel-libusb"
mac-app-bundle: "true"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: brew install libusb pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: darwin
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
# macOS ARM64 (m1, m2, m3, mX)
build-darwin-arm64-app:
name: Build ${{ matrix.artifact-name }}
runs-on: macos-14
needs: build-frontend
strategy:
matrix:
include:
- arch: "arm64"
tags: "ELECTRON"
artifact-name: "snd-macos-m1"
mac-app-bundle: "true"
- arch: "arm64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-macos-m1-libusb"
mac-app-bundle: "true"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: brew install libusb pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: darwin
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
create-release:
runs-on: ubuntu-latest
needs: [build-linux-app, build-windows-app, build-darwin-amd64-app, build-darwin-arm64-app]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: build/release
- name: Check release files
run: ls -hal build/release/
# Fix for https://github.com/actions/upload-artifact/issues/38
- name: Change Permissions
run: |
find build/release -type f -name 'snd' -exec chmod +x {} \;
find build/release -type f -name 'Sales & Dungeons' -exec chmod +x {} \;
- name: Zip release folders
run: cd build/release && { for i in */; do zip -r "${i%/}.zip" "$i"; done }
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: false
fail_on_unmatched_files: true
files: build/release/*.zip
release-itch:
permissions: write-all
name: release itch
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Download Release
uses: robinraju/release-downloader@v1
with:
repository: "BigJk/snd"
tag: ${{ github.ref_name }}
fileName: "*.zip"
- name: Install Butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
rm butler.zip
./butler -V
- name: Push to Itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
./butler push snd-windows-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:windows-amd64 --userversion ${{ github.ref_name }}
./butler push snd-macos-m1-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-m1 --userversion ${{ github.ref_name }}
./butler push snd-macos-intel-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-intel --userversion ${{ github.ref_name }}
./butler push snd-linux-amd64-gui-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:linux-amd64 --userversion ${{ github.ref_name }}
./butler push snd-macos-m1-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-m1-libusb --userversion ${{ github.ref_name }}
./butler push snd-macos-intel-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-intel-libusb --userversion ${{ github.ref_name }}
./butler push snd-linux-amd64-gui-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:linux-amd64-libusb --userversion ${{ github.ref_name }}