Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
2025-10-10 15:34:36 +08:00
5 changed files with 200 additions and 11 deletions

View File

@@ -301,32 +301,58 @@ class DatabaseVersionManager:
def update_config_version(self, new_version: str): def update_config_version(self, new_version: str):
"""更新config.py中的APP_VERSION""" """更新config.py中的APP_VERSION"""
logger.info(f"正在更新config.py到版本: {new_version}")
logger.info(f"配置文件路径: {self.config_file}")
logger.info(f"配置文件绝对路径: {self.config_file.absolute()}")
logger.info(f"配置文件是否存在: {self.config_file.exists()}")
if not self.config_file.exists(): if not self.config_file.exists():
logger.warning(f"配置文件不存在: {self.config_file}") logger.error(f"配置文件不存在: {self.config_file}")
return False return False
try: try:
# 读取文件
with open(self.config_file, 'r', encoding='utf-8') as f: with open(self.config_file, 'r', encoding='utf-8') as f:
content = f.read() content = f.read()
logger.info(f"已读取config.py文件大小: {len(content)} 字节")
# 查找当前版本
import re import re
pattern = r'APP_VERSION\s*=\s*["\'][\d.]+["\']' pattern = r'APP_VERSION\s*=\s*["\'][\d.]+["\']'
replacement = f'APP_VERSION = "{new_version}"' match = re.search(pattern, content)
if re.search(pattern, content): if match:
old_version_line = match.group(0)
logger.info(f"找到当前版本行: {old_version_line}")
replacement = f'APP_VERSION = "{new_version}"'
new_content = re.sub(pattern, replacement, content) new_content = re.sub(pattern, replacement, content)
logger.info(f"准备写入新版本: {replacement}")
# 写入文件
with open(self.config_file, 'w', encoding='utf-8') as f: with open(self.config_file, 'w', encoding='utf-8') as f:
f.write(new_content) f.write(new_content)
# 验证写入
with open(self.config_file, 'r', encoding='utf-8') as f:
verify_content = f.read()
verify_match = re.search(pattern, verify_content)
if verify_match:
logger.info(f"✅ 写入验证成功: {verify_match.group(0)}")
logger.info(f"✅ 已更新 config.py: APP_VERSION = \"{new_version}\"") logger.info(f"✅ 已更新 config.py: APP_VERSION = \"{new_version}\"")
return True return True
else: else:
logger.warning("未找到APP_VERSION配置项") logger.error(f"未找到APP_VERSION配置项pattern: {pattern}")
logger.info(f"文件内容预览前200字符: {content[:200]}")
return False return False
except Exception as e: except Exception as e:
logger.error(f"更新config.py失败: {e}") logger.error(f"更新config.py失败: {e}")
import traceback
logger.error(traceback.format_exc())
return False return False
def create_version_record(self) -> dict: def create_version_record(self) -> dict:

View File

@@ -5,7 +5,6 @@
用于查看和管理GUI客户端的版本历史记录 用于查看和管理GUI客户端的版本历史记录
""" """
import sys
import json import json
import argparse import argparse
from pathlib import Path from pathlib import Path

View File

@@ -141,23 +141,43 @@ jobs:
git config user.name "Gitea Actions Bot" git config user.name "Gitea Actions Bot"
git config user.email "bot@gitea.local" git config user.email "bot@gitea.local"
# 检查文件状态
Write-Host "=== Git Status Before Add ==="
git status
Write-Host "`n=== Checking file changes ==="
Write-Host "config.py changes:"
git diff config.py | Select-Object -First 10
Write-Host "version_history.json changes:"
git diff version_history.json | Select-Object -First 10
# 添加修改的文件 # 添加修改的文件
Write-Host "`n=== Adding files ==="
git add config.py git add config.py
Write-Host "Added config.py"
git add version_history.json git add version_history.json
Write-Host "Added version_history.json"
# 检查暂存区
Write-Host "`n=== Git Status After Add ==="
git status
Write-Host "`n=== Staged changes ==="
git diff --staged --stat
# 检查是否有变更 # 检查是否有变更
$hasChanges = git diff --staged --quiet $hasChanges = git diff --staged --quiet
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
# 动态获取当前分支名(兼容 master 和 develop # 动态获取当前分支名(兼容 master 和 develop
$BRANCH = "${{ github.ref_name }}" $BRANCH = "${{ github.ref_name }}"
Write-Host "Committing to branch: $BRANCH" Write-Host "`nCommitting to branch: $BRANCH"
git commit -m "[skip ci] 🤖 自动更新版本到 v$VERSION" git commit -m "[skip ci] Update version to v$VERSION"
git push origin $BRANCH git push origin $BRANCH
Write-Host "Version changes committed and pushed to $BRANCH" Write-Host "Version changes committed and pushed to $BRANCH"
} else { } else {
Write-Host " No changes to commit" Write-Host "No changes to commit"
} }
# Step 6: Display summary # Step 6: Display summary

View File

@@ -42,7 +42,7 @@ VERSION = "1.0"
WINDOW_TITLE = "AI回复连接入口-V1.0" WINDOW_TITLE = "AI回复连接入口-V1.0"
# 应用版本号(用于版本检查) # 应用版本号(用于版本检查)
APP_VERSION = "1.4.7" APP_VERSION = "1.4.22"
# 平台特定配置 # 平台特定配置
PLATFORMS = { PLATFORMS = {

View File

@@ -1,4 +1,148 @@
[ [
{
"version": "1.4.22",
"update_type": "patch",
"content": "强制空提交",
"author": "Gitea Actions",
"commit_hash": "8c150054a05a7b0d4795c43d0f2ff8ffade5ae15",
"commit_short_hash": "8c150054",
"branch": "develop",
"release_time": "2025-10-10 14:42:05",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 0,
"lines_added": 0,
"lines_deleted": 0
}
},
{
"version": "1.4.21",
"update_type": "patch",
"content": "强制空提交",
"author": "Gitea Actions",
"commit_hash": "95acd6e76a7a8ed96c92ae9f55a5ae43f913ddac",
"commit_short_hash": "95acd6e7",
"branch": "develop",
"release_time": "2025-10-10 14:39:17",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 0,
"lines_added": 0,
"lines_deleted": 0
}
},
{
"version": "1.4.19",
"update_type": "patch",
"content": "Merge branch 'develop' of http://120.92.90.209:3000/magua/shuidrop_gui into develop",
"author": "Gitea Actions",
"commit_hash": "00391fba67f142e9b6966141a712c9719887e295",
"commit_short_hash": "00391fba",
"branch": "develop",
"release_time": "2025-10-10 14:32:03",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 1,
"lines_added": 16,
"lines_deleted": 0
}
},
{
"version": "1.4.18",
"update_type": "patch",
"content": "[patch] 增强版本更新日志输出",
"author": "Gitea Actions",
"commit_hash": "e60c99d81ee0dc5f4c8817591a47f5364b8b1e55",
"commit_short_hash": "e60c99d8",
"branch": "develop",
"release_time": "2025-10-10 14:27:27",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 1,
"lines_added": 31,
"lines_deleted": 5
}
},
{
"version": "1.4.17",
"update_type": "patch",
"content": "[skip ci] Update version to v1.4.16",
"author": "jjz",
"commit_hash": "1b196ac4ca8b34ecb823073f8083497921a75800",
"commit_short_hash": "1b196ac4",
"branch": "develop",
"release_time": "2025-10-10 14:20:34",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 1,
"lines_added": 16,
"lines_deleted": 0
}
},
{
"version": "1.4.16",
"update_type": "patch",
"content": "强制空提交",
"author": "Gitea Actions",
"commit_hash": "0bdac1bff827a07d3a7894ada990c652ddc3db11",
"commit_short_hash": "0bdac1bf",
"branch": "develop",
"release_time": "2025-10-10 14:18:26",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 0,
"lines_added": 0,
"lines_deleted": 0
}
},
{
"version": "1.4.15",
"update_type": "patch",
"content": "强制空提交",
"author": "Gitea Actions",
"commit_hash": "dddf9a7a74b4feef1e6d600e97855d6390e2c1e1",
"commit_short_hash": "dddf9a7a",
"branch": "develop",
"release_time": "2025-10-10 14:07:49",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 0,
"lines_added": 0,
"lines_deleted": 0
}
},
{
"version": "1.4.14",
"update_type": "patch",
"content": "强制空提交",
"author": "Gitea Actions",
"commit_hash": "8eb17baf35fd83015d184ea1676314076a90234b",
"commit_short_hash": "8eb17baf",
"branch": "develop",
"release_time": "2025-10-10 13:47:31",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 0,
"lines_added": 0,
"lines_deleted": 0
}
},
{
"version": "1.4.13",
"update_type": "patch",
"content": "Merge remote-tracking branch 'origin/develop' into develop",
"author": "haosicheng",
"commit_hash": "6ad58b81b0143ac77138235f6ecbb93805fd6db7",
"commit_short_hash": "6ad58b81",
"branch": "develop",
"release_time": "2025-10-10 12:05:18",
"download_url": "https://www.baidu.com",
"stats": {
"files_changed": 1,
"lines_added": 17,
"lines_deleted": 2
}
},
{ {
"version": "1.4.12", "version": "1.4.12",
"update_type": "patch", "update_type": "patch",