-
Notifications
You must be signed in to change notification settings - Fork 746
131 lines (113 loc) · 3.71 KB
/
Copy pathbuild.yml
File metadata and controls
131 lines (113 loc) · 3.71 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: 多平台打包发布
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: '版本号 (如 v1.0.0)'
required: false
default: 'dev'
jobs:
build:
name: 打包 ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
artifact_name: codex-register.exe
asset_name: codex-register-v2-windows-x64.exe
- os: ubuntu-latest
artifact_name: codex-register
asset_name: codex-register-v2-linux-x64
- os: macos-latest
artifact_name: codex-register
asset_name: codex-register-v2-macos-arm64
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 设置 Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: 安装依赖
run: |
pip install -r requirements.txt pyinstaller
- name: 打包
run: |
pyinstaller codex_register.spec --clean --noconfirm
- name: 上传构建产物
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: dist/${{ matrix.artifact_name }}
if-no-files-found: error
release:
name: 创建发布
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: 检出代码(获取附加文件)
uses: actions/checkout@v4
- name: 下载所有构建产物
uses: actions/download-artifact@v4
with:
path: dist/
- name: 整理文件并打包 zip
run: |
mkdir -p release
# download-artifact@v4 将每个 artifact 放在 dist/<asset_name>/ 子目录下
# 遍历子目录,用目录名作为平台标识(即 matrix.asset_name)
for artifact_dir in dist/*/; do
platform=$(basename "$artifact_dir")
# 找到该目录下的二进制文件(只有一个)
binary=$(find "$artifact_dir" -maxdepth 1 -type f | head -n1)
if [ -z "$binary" ]; then
echo "警告:$artifact_dir 下没有找到文件,跳过"
continue
fi
tmpdir="tmp_${platform}"
mkdir -p "$tmpdir"
cp "$binary" "$tmpdir/"
cp README.md "$tmpdir/README.md"
cp .env.example "$tmpdir/.env.example"
[ -f LICENSE ] && cp LICENSE "$tmpdir/LICENSE" || true
cd "$tmpdir"
zip -r "../release/${platform}.zip" .
cd ..
rm -rf "$tmpdir"
done
ls -lh release/
- name: 创建 GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/*
generate_release_notes: true
body: |
## OpenAI 账号管理系统 v2
### 下载说明
| 平台 | 文件 |
|------|------|
| Windows x64 | `codex-register-v2-windows-x64.exe` |
| Linux x64 | `codex-register-v2-linux-x64` |
| macOS ARM64 | `codex-register-v2-macos-arm64` |
### 使用方法
```bash
# Linux/macOS 需要先赋予执行权限
chmod +x codex-register-*
# 启动 Web UI
./codex-register
# 指定端口
./codex-register --port 8080
# 调试模式(热重载)
./codex-register --debug
# 设置 Web UI 访问密钥
./codex-register --access-password mypassword
```