-
Notifications
You must be signed in to change notification settings - Fork 19
322 lines (272 loc) · 10.5 KB
/
dotnet-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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: ColorMC构建
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- 'releases/**'
# Sequence of patterns matched against refs/tags
tags:
- '*'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 设置.NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.401
- name: Read version number
id: version
run: |
VERSION=$(cat ./build/version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
MAINVERSION=$(cat ./build/main_version)
echo "MAINVERSION=$MAINVERSION" >> $GITHUB_ENV
- name: 更新源码
shell: bash
working-directory: ./
run: |
chmod a+x ./build/update.sh
./build/update.sh
- name: 构建源码
shell: bash
working-directory: ./
run: |
chmod a+x ./build/build-linux.sh
./build/build-linux.sh
- name: 构建 deb
shell: bash
working-directory: ./
run: |
chmod a+x ./build/build-ubuntu.sh
./build/build-ubuntu.sh
- name: 构建 rpm
shell: bash
working-directory: ./
run: |
chmod a+x ./build/build-rpm.sh
./build/build-rpm.sh
- name: 构建 pkg
run: |
docker run --name build-container -v "${{ github.workspace }}:/github/workspace" archlinux:latest /bin/bash -c "\
pacman -Syu --noconfirm base-devel git && \
useradd -m builder && \
cd /github/workspace && \
chown -R builder:builder /github/workspace/ && \
chmod -R 777 /github/workspace/ && \
echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder && \
sudo -u builder ./build/build-arch.sh"
- name: 上传 colormc-linux-x86_64-rpm
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-x86_64-rpm"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1.x86_64.rpm
- name: 上传 colormc-linux-aot-x86_64-rpm
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aot-x86_64-rpm"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-aot.x86_64.rpm
- name: 上传 colormc-linux-min-x86_64-rpm
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-x86_64-rpm"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-min.x86_64.rpm
- name: 上传 colormc-linux-aarch64-rpm
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aarch64-rpm"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1.aarch64.rpm
# - name: 上传 colormc-linux-aot-aarch64-rpm
# uses: actions/upload-artifact@v4
# with:
# name: "colormc-linux-aot-aarch64-rpm"
# path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-aot.aarch64.rpm
- name: 上传 colormc-linux-min-aarch64-rpm
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-aarch64-rpm"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-min.aarch64.rpm
- name: 上传 colormc-linux-x86_64-pkg
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-x86_64-pkg"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-x86_64.pkg.tar.zst
- name: 上传 colormc-linux-min-x86_64-pkg
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-x86_64-pkg"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-min-x86_64.pkg.tar.zst
- name: 上传 colormc-linux-aot-x86_64-pkg
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aot-x86_64-pkg"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-1-aot-x86_64.pkg.tar.zst
- name: 上传 colormc-linux-x86_64-deb
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-x86_64-deb"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-x86_64.deb
- name: 上传 colormc-linux-aot-x86_64-deb
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aot-x86_64-deb"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-aot-x86_64.deb
- name: 上传 colormc-linux-min-x86_64-deb
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-x86_64-deb"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-min-x86_64.deb
- name: 上传 colormc-linux-aarch64-deb
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aarch64-deb"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-arm64.deb
# - name: 上传 colormc-linux-aot-aarch64-deb
# uses: actions/upload-artifact@v4
# with:
# name: "colormc-linux-aot-aarch64-deb"
# path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-aot-arm64.deb
- name: 上传 colormc-linux-min-aarch64-de
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-aarch64-deb"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-min-arm64.deb
- name: 上传 linux-x64-appimage.deb
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-x86_64-appimage"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-x86_64.AppImage
- name: 上传 colormc-linux-aot-x86_64-appimage
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-aot-x86_64-appimage"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-aot-x86_64.AppImage
- name: 上传 colormc-linux-min-x86_64-appimage
uses: actions/upload-artifact@v4
with:
name: "colormc-linux-min-x86_64-appimage"
path: build_out/colormc-linux-${{ env.MAINVERSION }}${{ env.VERSION }}-min-x86_64.AppImage
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: 设置.NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.401
- name: Read version number
id: version
run: |
VERSION=$(cat ./build/version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
MAINVERSION=$(cat ./build/main_version)
echo "MAINVERSION=$MAINVERSION" >> $GITHUB_ENV
- name: 更新源码
shell: bash
working-directory: ./
run: |
chmod a+x ./build/update.sh
./build/update.sh
- name: 构建
shell: bash
working-directory: ./
run: |
chmod a+x ./build/build-macos.sh
./build/build-macos.sh
- name: 上传 colormc-macos-x86_64
uses: actions/upload-artifact@v4
with:
name: "colormc-macos-x86_64"
path: build_out/colormc-macos-${{ env.MAINVERSION }}${{ env.VERSION }}-x86_64.zip
- name: 上传 colormc-macos-min-x86_64
uses: actions/upload-artifact@v4
with:
name: "colormc-macos-min-x86_64"
path: build_out/colormc-macos-${{ env.MAINVERSION }}${{ env.VERSION }}-min-x86_64.zip
- name: 上传 colormc-macos-aarch64
uses: actions/upload-artifact@v4
with:
name: "colormc-macos-aarch64"
path: build_out/colormc-macos-${{ env.MAINVERSION }}${{ env.VERSION }}-aarch64.zip
- name: 上传 colormc-macos-min-aarch64
uses: actions/upload-artifact@v4
with:
name: "colormc-macos-min-aarch64"
path: build_out/colormc-macos-${{ env.MAINVERSION }}${{ env.VERSION }}-min-aarch64.zip
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Read version number
id: version
run: |
$version = Get-Content ./build/version
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$mainversion = Get-Content ./build/main_version
echo "MAINVERSION=$mainversion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: 设置.NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.401
- name: 更新源码
shell: cmd
working-directory: ./
run: ./build/update.cmd
- name: 构建 源码
shell: cmd
working-directory: ./
run: ./build/build-windows.cmd
- name: Build MSI with MSBuild
working-directory: ./
run: ./build/build-msi.cmd
- name: 上传 colormc-windows-x64-msi
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-x64-msi"
path: src/ColorMC.Setup.Wix/colormc-windows-${{ env.MAINVERSION }}${{ env.VERSION }}-x64.msi
- name: 上传 colormc-windows-x64-aot-msi
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-x64-aot-msi"
path: src/ColorMC.Setup.Wix/colormc-windows-${{ env.MAINVERSION }}${{ env.VERSION }}-aot-x64.msi
- name: 上传 colormc-windows-x64-min-msi
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-x64-min-msi"
path: src/ColorMC.Setup.Wix/colormc-windows-${{ env.MAINVERSION }}${{ env.VERSION }}-min-x64.msi
- name: 上传 colormc-windows-x86_64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-x86_64"
path: src/build_out/win-x64-dotnet/colormc/**
- name: 上传 colormc-windows-aot-x86_64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-aot-x86_64"
path: src/build_out/win-x64-aot/colormc/**
- name: 上传 colormc-windows-min-x86_64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-min-x86_64"
path: src/build_out/win-x64-min/colormc/**
- name: 上传 colormc-windows-x86
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-x86"
path: src/build_out/win-x86-dotnet/colormc/**
- name: 上传 colormc-windows-arm64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-arm64"
path: src/build_out/win-arm64-dotnet/colormc/**
- name: 上传 colormc-windows-aot-arm64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-aot-arm64"
path: src/build_out/win-arm64-aot/colormc/**
- name: 上传 colormc-windows-min-arm64
uses: actions/upload-artifact@v4
with:
name: "colormc-windows-min-arm64"
path: src/build_out/win-arm64-min/colormc/**