API密钥加密安全性改进以及自动更新功能

This commit is contained in:
Eric-Terminal
2025-09-18 02:03:16 +08:00
parent 7013346011
commit 5f637c191c
7 changed files with 120 additions and 20 deletions

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

@@ -0,0 +1,63 @@
# 工作流的名称
name: Build Cross-Platform Executables
# Trivial change to force a cache refresh
# 触发条件:
# 1. 当代码被推送到 main 分支时
# 2. 当你创建一个新的 "Tag" (用于发布新版本)
# 3. 允许你在GitHub页面手动触发
on:
push:
branches: [ "main" ]
release:
types: [ created ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
# 第1步检出你的代码
- name: Checkout repository
uses: actions/checkout@v4
# 第2步设置Python环境
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13.3' # 你可以根据需要更改Python版本
# 第3步安装依赖包
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
# 第4步使用PyInstaller打包
# --noconsole: 这是一个GUI应用不显示控制台窗口
# --onefile: 打包成单个.exe文件
# --name: 指定生成的可执行文件名
- name: Build with PyInstaller
run: pyinstaller --noconsole --onefile --name "AI-Essay-Corrector" main.py
# 第5步将打包好的上传以便在工作流页面下载 (适合测试)
- name: Upload artifact for testing
uses: actions/upload-artifact@v4
with:
name: AI-Essay-Corrector-${{ matrix.os }}
path: dist/AI-Essay-Corrector*
# 第6步 (专业级开源发布): 当你创建Tag时自动创建Release并附上.exe
- name: Create Release and Upload Asset
if: startsWith(github.ref, 'refs/tags/') # 仅在创建Tag时运行此步骤
uses: softprops/action-gh-release@v2
with:
files: dist/AI-Essay-Corrector*