-
Notifications
You must be signed in to change notification settings - Fork 4
125 lines (109 loc) · 3.75 KB
/
build.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: 编译
on:
workflow_dispatch:
inputs:
release:
description: "是否发行"
type: boolean
tag:
description: "版本号"
default: vx.x.x
permissions:
contents: read
jobs:
windows-build:
name: Windows 编译
runs-on: windows-latest
steps:
- name: 拉取仓库
uses: actions/checkout@v4
- name: 设置 Python 3.8
uses: actions/setup-python@v3
with:
python-version: "3.8.0"
- name: 安装 uv
run: |
python -m pip install --upgrade pip
pip install uv
- name: 虚拟环境 && 编译
run: |
uv venv
.venv\Scripts\activate
uv pip install -r requirements.txt -U pyinstaller==5.13.2
uv run pyinstaller -D -i icon.ico launcher.py
- name: 移动依赖
run: |
cd .venv\Lib\site-packages
mv streamlit ..\..\..\dist\launcher\streamlit
mv streamlit-1.40.1.dist-info ..\..\..\dist\launcher\streamlit-1.40.1.dist-info
mv wx ..\..\..\dist\launcher\wx
mv rembg ..\..\..\dist\launcher\rembg
mv pooch ..\..\..\dist\launcher\pooch
mv cv2 ..\..\..\dist\launcher\cv2
mv onnxruntime ..\..\..\dist\launcher\onnxruntime
mv pymatting ..\..\..\dist\launcher\pymatting
- name: 移动页面
run: |
mv app.py dist\launcher\app.py
mv pages dist\launcher\pages
- name: 打包上传
uses: actions/[email protected]
with:
name: DaYePhotoStudio-2
path: dist\launcher
models:
name: 模型下载
runs-on: ubuntu-latest
steps:
- name: 下载模型
run: |
mkdir models
cd models
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-anime.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-general-use.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/silueta.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_cloth_seg.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx
wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnx
- name: 打包上传
uses: actions/[email protected]
with:
name: models
path: models
release:
name: 发行
if: ${{ inputs.release }}
runs-on: ubuntu-latest
needs: [windows-build, models]
permissions:
contents: write
steps:
- name: 下载附件
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Windows 压缩(仅程序本体)
run: cd artifacts && zip -r ../DaYePhotoStudio-2.zip DaYePhotoStudio-2
- name: 模型包
run: |
cd artifacts
mv models .u2net
zip -r ../models.zip .u2net
- name: 完整版压缩
run: |
mv artifacts/.u2net artifacts/DaYePhotoStudio-2/.u2net
cd artifacts && zip -r ../DaYePhotoStudio-2-full.zip DaYePhotoStudio-2
- name: 发行
uses: softprops/action-gh-release@v2
with:
name: ${{ inputs.tag }}
tag_name: ${{ inputs.tag }}
draft: false
make_latest: true
files: |
DaYePhotoStudio-2.zip
DaYePhotoStudio-2-full.zip
models.zip