-
-
Notifications
You must be signed in to change notification settings - Fork 53
262 lines (250 loc) · 8.69 KB
/
release.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
name: Release WebGAL Terre
on:
workflow_dispatch:
push:
tags:
- '*.*'
jobs:
build-linux:
name: Build Linux Binary
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: sh release-linux.sh
- name: Compress
run: 7z a -tzip WebGAL_Terre_Linux.zip release/*
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: WebGAL_Terre_Linux
path: WebGAL_Terre_Linux.zip
build-arm64:
name: Build Linux ARM64 Binary
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build Stage 1
run: |
echo "Welcome to build WebGAL Terre, the editor of WebGAL platform."
# 安装依赖
yarn install --frozen-lockfile
# 清理
test -d release && rm -rf release
mkdir release
# 进入 Terre 目录
cd packages/terre2
yarn run build
- name: Build pkg ARM64
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
bind_mount_repository: true
commands: |
apt-get update
apt-get install -y curl sudo
# Install Node.js v18.x
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt-get install -y nodejs
# Enable yarn
corepack prepare [email protected] --activate
corepack enable yarn
cd packages/terre2
yarn run pkg:linux-arm64
- name: Build Stage 2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
sudo chmod 777 -R .
cd packages/terre2/dist
cp -r WebGAL_Terre ../../../release
rm WebGAL_Terre
cd ../
mkdir Exported_Games
cp -r public assets Exported_Games ../../release
cd ../../
# 进入 Origine 目录
cd packages/origine2
# 低内存,使用下一行限制内存使用
# export NODE_OPTIONS=--max_old_space_size=512000
yarn run build
cp -rf dist/* ../../release/public/
cd ../../
# 进入 Electron 目录
cd packages/WebGAL-electron
yarn install --frozen-lockfile
yarn run build:arm64
mkdir ../../release/assets/templates/WebGAL_Electron_Template
cp -rf build/linux-arm64-unpacked/* ../../release/assets/templates/WebGAL_Electron_Template/
cd ../../
# 克隆 WebGAL Android 模板
cd release/assets/templates/
git clone https://github.com/nini22P/WebGAL-Android.git
mv WebGAL-Android WebGAL_Android_Template
# MainActivity.kt 移动到主文件夹防止误删
mv WebGAL_Android_Template/app/src/main/java/com/openwebgal/demo/MainActivity.kt WebGAL_Android_Template/app/src/main/java/MainActivity.kt
cd ../../../
cd release
# 删除冗余文件
rm -rf Exported_Games/*
rm -rf public/games/*
rm -rf public/games/.gitkeep
rm -rf assets/templates/WebGAL_Template/game/video/*
rm -rf assets/templates/WebGAL_Template/game/video/.gitkeep
rm -rf assets/templates/WebGAL_Android_Template/.github
rm -rf assets/templates/WebGAL_Android_Template/.git
rm -rf assets/templates/WebGAL_Android_Template/.gitattributes
rm -rf assets/templates/WebGAL_Android_Template/app/src/main/assets/webgal/.gitkeep
rm -rf assets/templates/WebGAL_Android_Template/app/src/main/java/com
echo "WebGAL Terre is now ready to be deployed."
- name: Compress
run: 7z a -tzip WebGAL_Terre_Linux_Arm64.zip release/*
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: WebGAL_Terre_Linux_Arm64
path: WebGAL_Terre_Linux_Arm64.zip
build-mac:
name: Build MacOS Binary
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: sh release-mac.sh
- name: Compress
run: 7z a -tzip WebGAL_Terre_Mac.zip release/*
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: WebGAL_Terre_Mac
path: WebGAL_Terre_Mac.zip
build-windows:
name: Build Windows Binary
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build
shell: bash
run: ./release.sh
- name: Compress
run: 7z a -tzip WebGAL_Terre_Windows.zip release/*
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: WebGAL_Terre_Windows
path: WebGAL_Terre_Windows.zip
build-windows-nsis:
name: Build Windows Setup
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build
shell: bash
run: ./release.sh
- name: Build Setup
shell: bash
run: mkdir bundle && yarn nsis-bundle
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: WebGAL_Terre_Windows_Setup
path: bundle/WebGal_Terre_Setup.exe
release:
name: Release
runs-on: ubuntu-latest
needs: ['build-linux','build-arm64','build-mac','build-windows','build-windows-nsis']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: WebGAL Terre ${{ github.ref }}
body_path: releasenote.md
draft: true
prerelease: false
- name: Upload Linux Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WebGAL_Terre_Linux/WebGAL_Terre_Linux.zip
asset_name: WebGAL_Terre_Linux_${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload Linux Arm64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WebGAL_Terre_Linux_Arm64/WebGAL_Terre_Linux_Arm64.zip
asset_name: WebGAL_Terre_Linux_Arm64_${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload MacOS Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WebGAL_Terre_Mac/WebGAL_Terre_Mac.zip
asset_name: WebGAL_Terre_Mac_${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload Windows Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WebGAL_Terre_Windows/WebGAL_Terre_Windows.zip
asset_name: WebGAL_Terre_Windows_${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload Windows Setup Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WebGAL_Terre_Windows_Setup/WebGal_Terre_Setup.exe
asset_name: WebGAL_Terre_Windows_Setup_${{ github.ref_name }}.exe
asset_content_type: application/vnd.microsoft.portable-executable