-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (92 loc) · 3.16 KB
/
release.yml
File metadata and controls
112 lines (92 loc) · 3.16 KB
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
name: Build and Release
on:
push:
tags:
- 'v*'
# 添加权限配置
permissions:
contents: write # 添加写入权限
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13.2'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
# 注意:不需要提前构建前端,build.py 脚本会处理前端构建
# 只需要确保 Node.js 环境已设置好
- name: Build with PyInstaller
run: |
# 设置UTF-8编码
$Env:PYTHONIOENCODING = "utf-8"
python build.py
- name: List dist directory
run: |
dir dist
echo "-----------------------------------"
if (Test-Path -Path "dist\frontend") {
echo "frontend directory exists"
dir dist\frontend
} else {
echo "frontend directory does NOT exist"
}
if (Test-Path -Path "dist\static") {
echo "static directory exists"
dir dist\static
} else {
echo "static directory does NOT exist"
}
- name: Create ZIP archive
run: |
cd dist
$VERSION = (Get-Item "SD_Models_Manager_v*.exe").BaseName
New-Item -ItemType Directory -Path "$VERSION"
Move-Item "SD_Models_Manager_v*.exe" "$VERSION"
# 创建data目录
New-Item -ItemType Directory -Path "$VERSION\data"
Write-Host "Created data directory for storing prompt library"
# 只在 frontend 目录存在时才移动它
if (Test-Path -Path "frontend") {
Move-Item "frontend" "$VERSION"
Write-Host "Moved frontend directory to package"
}
# 只在 static 目录存在时才移动它
if (Test-Path -Path "static") {
Move-Item "static" "$VERSION"
Write-Host "Moved static directory to package"
}
# 只在 data 目录存在时才移动它
if (Test-Path -Path "data") {
Move-Item "data" "$VERSION"
Write-Host "Moved data directory to package"
}
# 确保目录结构完整
if (-not (Test-Path -Path "$VERSION\static")) {
New-Item -ItemType Directory -Path "$VERSION\static"
New-Item -ItemType Directory -Path "$VERSION\static\images"
Write-Host "Created empty static directory structure in package"
}
# 显示最终的包结构
Write-Host "Final package structure:"
dir "$VERSION" -Recurse
Compress-Archive -Path "$VERSION" -DestinationPath "$VERSION.zip"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/SD_Models_Manager_v*.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}