Skip to content

Commit e87550a

Browse files
Update release.yml
1 parent 4916c24 commit e87550a

File tree

1 file changed

+182
-0
lines changed

1 file changed

+182
-0
lines changed

.github/workflows/release.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,189 @@ on:
55
push:
66
tags:
77
- '*.*'
8+
89
jobs:
10+
build-linux:
11+
name: Build Linux Binary
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Install Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 18
20+
cache: 'yarn'
21+
- name: Build
22+
env:
23+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
24+
run: sh release-linux.sh
25+
26+
- name: Compress
27+
run: 7z a -tzip WebGAL_Terre_Linux.zip release/*
28+
29+
- name: Upload Artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: WebGAL_Terre_Linux
33+
path: WebGAL_Terre_Linux.zip
34+
build-arm64:
35+
name: Build Linux ARM64 Binary
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
- name: Install Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 18
44+
cache: 'yarn'
45+
- name: Build Stage 1
46+
run: |
47+
echo "Welcome to build WebGAL Terre, the editor of WebGAL platform."
48+
# 安装依赖
49+
yarn install --frozen-lockfile
50+
# 清理
51+
test -d release && rm -rf release
52+
mkdir release
53+
# 进入 Terre 目录
54+
cd packages/terre2
55+
yarn run build
56+
- name: Build pkg ARM64
57+
uses: pguyot/arm-runner-action@v2
58+
with:
59+
base_image: raspios_lite_arm64:latest
60+
bind_mount_repository: true
61+
commands: |
62+
apt-get update
63+
apt-get install -y curl sudo
64+
# Install Node.js v18.x
65+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
66+
apt-get install -y nodejs
67+
# Enable yarn
68+
corepack prepare yarn@1.22.19 --activate
69+
corepack enable yarn
70+
cd packages/terre2
71+
yarn run pkg:linux-arm64
72+
- name: Build Stage 2
73+
env:
74+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
75+
run: |
76+
sudo chmod 777 -R .
77+
cd packages/terre2/dist
78+
cp -r WebGAL_Terre ../../../release
79+
rm WebGAL_Terre
80+
cd ../
81+
mkdir Exported_Games
82+
cp -r public assets Exported_Games ../../release
83+
cd ../../
84+
# 进入 Origine 目录
85+
cd packages/origine2
86+
# 低内存,使用下一行限制内存使用
87+
# export NODE_OPTIONS=--max_old_space_size=512000
88+
yarn run build
89+
cp -rf dist/* ../../release/public/
90+
cd ../../
91+
# 进入 Electron 目录
92+
cd packages/WebGAL-electron
93+
yarn install --frozen-lockfile
94+
yarn run build:arm64
95+
mkdir ../../release/assets/templates/WebGAL_Electron_Template
96+
cp -rf build/linux-arm64-unpacked/* ../../release/assets/templates/WebGAL_Electron_Template/
97+
cd ../../
98+
# 克隆 WebGAL Android 模板
99+
cd release/assets/templates/
100+
git clone https://github.com/nini22P/WebGAL-Android.git
101+
mv WebGAL-Android WebGAL_Android_Template
102+
# MainActivity.kt 移动到主文件夹防止误删
103+
mv WebGAL_Android_Template/app/src/main/java/com/openwebgal/demo/MainActivity.kt WebGAL_Android_Template/app/src/main/java/MainActivity.kt
104+
cd ../../../
105+
cd release
106+
# 删除冗余文件
107+
rm -rf Exported_Games/*
108+
rm -rf public/games/*
109+
rm -rf public/games/.gitkeep
110+
rm -rf assets/templates/WebGAL_Template/game/video/*
111+
rm -rf assets/templates/WebGAL_Template/game/video/.gitkeep
112+
rm -rf assets/templates/WebGAL_Android_Template/.github
113+
rm -rf assets/templates/WebGAL_Android_Template/.git
114+
rm -rf assets/templates/WebGAL_Android_Template/.gitattributes
115+
rm -rf assets/templates/WebGAL_Android_Template/app/src/main/assets/webgal/.gitkeep
116+
rm -rf assets/templates/WebGAL_Android_Template/app/src/main/java/com
117+
echo "WebGAL Terre is now ready to be deployed."
118+
119+
- name: Compress
120+
run: 7z a -tzip WebGAL_Terre_Linux_Arm64.zip release/*
121+
- name: Upload Artifact
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: WebGAL_Terre_Linux_Arm64
125+
path: WebGAL_Terre_Linux_Arm64.zip
126+
build-mac:
127+
name: Build MacOS Binary
128+
runs-on: macos-14
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v4
132+
- name: Install Node.js
133+
uses: actions/setup-node@v4
134+
with:
135+
node-version: 18
136+
cache: 'yarn'
137+
- name: Build
138+
env:
139+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
140+
run: sh release-mac.sh
141+
- name: Compress
142+
run: 7z a -tzip WebGAL_Terre_Mac.zip release/*
143+
- name: Upload Artifact
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: WebGAL_Terre_Mac
147+
path: WebGAL_Terre_Mac.zip
148+
build-windows:
149+
name: Build Windows Binary
150+
runs-on: windows-latest
151+
steps:
152+
- name: Checkout
153+
uses: actions/checkout@v4
154+
- name: Install Node.js
155+
uses: actions/setup-node@v4
156+
with:
157+
node-version: 18
158+
cache: 'yarn'
159+
- name: Build
160+
shell: bash
161+
run: ./release.sh
162+
- name: Compress
163+
run: 7z a -tzip WebGAL_Terre_Windows.zip release/*
164+
- name: Upload Artifact
165+
uses: actions/upload-artifact@v4
166+
with:
167+
name: WebGAL_Terre_Windows
168+
path: WebGAL_Terre_Windows.zip
169+
build-windows-nsis:
170+
name: Build Windows Setup
171+
runs-on: windows-latest
172+
steps:
173+
- name: Checkout
174+
uses: actions/checkout@v4
175+
- name: Install Node.js
176+
uses: actions/setup-node@v4
177+
with:
178+
node-version: 18
179+
cache: 'yarn'
180+
- name: Build
181+
shell: bash
182+
run: ./release.sh
183+
- name: Build Setup
184+
shell: bash
185+
run: mkdir bundle && yarn nsis-bundle
186+
- name: Upload Artifact
187+
uses: actions/upload-artifact@v4
188+
with:
189+
name: WebGAL_Terre_Windows_Setup
190+
path: bundle/WebGal_Terre_Setup.exe
9191
release:
10192
name: Release
11193
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)