mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-05-06 20:02:51 +08:00
feat(core): 支持PyInstaller打包并优化资源路径
- 修改app.py以支持PyInstaller打包后的资源路径 - 更新session.py以支持APP_DATA_DIR环境变量 - 增强webui.py以设置打包后的数据目录 - 添加pyproject.toml的PyInstaller依赖组 - 新增构建脚本和GitHub Actions工作流
This commit is contained in:
105
.github/workflows/build.yml
vendored
Normal file
105
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
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-windows-x64.exe
|
||||
- os: ubuntu-latest
|
||||
artifact_name: codex-register
|
||||
asset_name: codex-register-linux-x64
|
||||
- os: macos-latest
|
||||
artifact_name: codex-register
|
||||
asset_name: codex-register-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/download-artifact@v4
|
||||
with:
|
||||
path: dist/
|
||||
|
||||
- name: 整理文件
|
||||
run: |
|
||||
mkdir -p release
|
||||
find dist/ -type f | while read f; do
|
||||
name=$(basename "$f")
|
||||
cp "$f" "release/$name"
|
||||
done
|
||||
ls -lh release/
|
||||
|
||||
- name: 创建 GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: release/*
|
||||
generate_release_notes: true
|
||||
body: |
|
||||
## OpenAI/Codex CLI 自动注册系统
|
||||
|
||||
### 下载说明
|
||||
| 平台 | 文件 |
|
||||
|------|------|
|
||||
| Windows x64 | `codex-register-windows-x64.exe` |
|
||||
| Linux x64 | `codex-register-linux-x64` |
|
||||
| macOS ARM64 | `codex-register-macos-arm64` |
|
||||
|
||||
### 使用方法
|
||||
```bash
|
||||
# Linux/macOS 需要先赋予执行权限
|
||||
chmod +x codex-register-*
|
||||
|
||||
# 启动 Web UI
|
||||
./codex-register
|
||||
|
||||
# 指定端口
|
||||
./codex-register --port 8080
|
||||
```
|
||||
Reference in New Issue
Block a user