Skip to content

Commit b748954

Browse files
committed
优化:更新 GitHub Actions 工作流
1 parent fe63bfa commit b748954

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,65 @@ jobs:
3030
run: |
3131
python -m pip install --upgrade pip
3232
pip install -r requirements.txt
33+
pip install pyinstaller
3334
34-
- name: Install Frontend dependencies and build
35-
run: |
36-
cd frontend
37-
npm install
38-
npm run build
35+
# 注意:不需要提前构建前端,build.py 脚本会处理前端构建
36+
# 只需要确保 Node.js 环境已设置好
3937

4038
- name: Build with PyInstaller
41-
run: python build.py
39+
run: |
40+
# 设置UTF-8编码
41+
$Env:PYTHONIOENCODING = "utf-8"
42+
python build.py
43+
44+
- name: List dist directory
45+
run: |
46+
dir dist
47+
echo "-----------------------------------"
48+
if (Test-Path -Path "dist\frontend") {
49+
echo "frontend directory exists"
50+
dir dist\frontend
51+
} else {
52+
echo "frontend directory does NOT exist"
53+
}
54+
55+
if (Test-Path -Path "dist\static") {
56+
echo "static directory exists"
57+
dir dist\static
58+
} else {
59+
echo "static directory does NOT exist"
60+
}
4261
4362
- name: Create ZIP archive
4463
run: |
4564
cd dist
4665
$VERSION = (Get-Item "SD_Models_Manager_v*.exe").BaseName
4766
New-Item -ItemType Directory -Path "$VERSION"
4867
Move-Item "SD_Models_Manager_v*.exe" "$VERSION"
49-
Move-Item "static" "$VERSION"
68+
69+
# 只在 frontend 目录存在时才移动它
70+
if (Test-Path -Path "frontend") {
71+
Move-Item "frontend" "$VERSION"
72+
Write-Host "Moved frontend directory to package"
73+
}
74+
75+
# 只在 static 目录存在时才移动它
76+
if (Test-Path -Path "static") {
77+
Move-Item "static" "$VERSION"
78+
Write-Host "Moved static directory to package"
79+
}
80+
81+
# 确保目录结构完整
82+
if (-not (Test-Path -Path "$VERSION\static")) {
83+
New-Item -ItemType Directory -Path "$VERSION\static"
84+
New-Item -ItemType Directory -Path "$VERSION\static\images"
85+
Write-Host "Created empty static directory structure in package"
86+
}
87+
88+
# 显示最终的包结构
89+
Write-Host "Final package structure:"
90+
dir "$VERSION" -Recurse
91+
5092
Compress-Archive -Path "$VERSION" -DestinationPath "$VERSION.zip"
5193
5294
- name: Create Release

0 commit comments

Comments
 (0)