feat: codex-register with Sub2API增强 + Playwright引擎
Some checks are pending
Docker Image CI / build-and-push-image (push) Waiting to run

This commit is contained in:
2026-03-22 00:24:16 +08:00
commit 0f9948ffc3
91 changed files with 29942 additions and 0 deletions

131
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,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-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/checkout@v4
- name: 下载所有构建产物
uses: actions/download-artifact@v4
with:
path: dist/
- name: 整理文件并打包 zip
run: |
mkdir -p release
# 为每个平台二进制文件打包成 zip
find dist/ -type f | while read f; do
name=$(basename "$f")
# 根据文件名确定平台标识
case "$name" in
*windows*) platform=$(echo "$name" | sed 's/\.[^.]*$//') ;;
*linux*) platform="$name" ;;
*macos*) platform="$name" ;;
*) platform="$name" ;;
esac
tmpdir="tmp_${platform}"
mkdir -p "$tmpdir"
cp "$f" "$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-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
# 调试模式(热重载)
./codex-register --debug
# 设置 Web UI 访问密钥
./codex-register --access-password mypassword
```

68
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,68 @@
name: Docker Image CI
on:
push:
branches: [ "master", "main" ]
# 当发布新版本时触发
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "master", "main" ]
env:
# GitHub Container Registry 的地址
REGISTRY: ghcr.io
# 镜像名称,默认为 GitHub 用户名/仓库名
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# 如果需要签名生成的镜像,可以使用 id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# 设置 Docker Buildx 用于构建多平台镜像 (可选)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 登录到 Docker 镜像仓库
# 如果只是在 PR 中测试构建,则跳过登录
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 提取 Docker 镜像的元数据(标签、注释等)
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
# 构建并推送 Docker 镜像
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max