Skip to content

Commit ef09df2

Browse files
committed
2 parents b72832b + f0ceb50 commit ef09df2

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

.github/workflows/main.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,49 @@ jobs:
9494
name: Build-Windows
9595
path: build/StandaloneWindows64
9696

97+
build_webgl:
98+
name: Build WebGL
99+
runs-on: ubuntu-latest
100+
steps:
101+
# 1. Checkout
102+
- name: Checkout repository
103+
uses: actions/checkout@v4
104+
with:
105+
lfs: true
106+
fetch-depth: 0
107+
108+
# 2. Cache:缓存 team_project/Library
109+
- uses: actions/cache@v3
110+
id: cache-library-build
111+
with:
112+
path: team_project/Library
113+
key: Library-build-${{ hashFiles('team_project/Assets/**', 'team_project/Packages/**', 'team_project/ProjectSettings/**') }}
114+
restore-keys: |
115+
Library-build-
116+
117+
# 3. Build project(WebGL 平台)
118+
- name: Build project
119+
uses: game-ci/unity-builder@v4
120+
env:
121+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
122+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
123+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
124+
with:
125+
projectPath: team_project
126+
targetPlatform: WebGL
127+
128+
# 4. Upload artifact:指向 WebGL 的构建输出目录
129+
- name: Upload Build-WebGL
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: Build-WebGL
133+
path: build/WebGL
134+
135+
- name: Deploy
136+
uses: actions/deploy-pages@v4
137+
with:
138+
artifact_name: Build-WebGL # 与上传名称匹配
139+
97140
docs:
98141
name: Generate and Deploy Documentation
99142
runs-on: ubuntu-latest
@@ -125,8 +168,3 @@ jobs:
125168
with:
126169
path: team_project/_site
127170
name: gh-pages # 自定义名称
128-
129-
- name: Deploy
130-
uses: actions/deploy-pages@v4
131-
with:
132-
artifact_name: gh-pages # 与上传名称匹配

0 commit comments

Comments
 (0)