diff --git a/.gitea/scripts/gui_version_creator.py b/.gitea/scripts/gui_version_creator.py index 65a82ef..7b0f74f 100644 --- a/.gitea/scripts/gui_version_creator.py +++ b/.gitea/scripts/gui_version_creator.py @@ -301,32 +301,58 @@ class DatabaseVersionManager: def update_config_version(self, new_version: str): """更新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(): - logger.warning(f"配置文件不存在: {self.config_file}") + logger.error(f"❌ 配置文件不存在: {self.config_file}") return False try: + # 读取文件 with open(self.config_file, 'r', encoding='utf-8') as f: content = f.read() + logger.info(f"已读取config.py,文件大小: {len(content)} 字节") + + # 查找当前版本 import re 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) + logger.info(f"准备写入新版本: {replacement}") + + # 写入文件 with open(self.config_file, 'w', encoding='utf-8') as f: 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}\"") return True else: - logger.warning("未找到APP_VERSION配置项") + logger.error(f"❌ 未找到APP_VERSION配置项,pattern: {pattern}") + logger.info(f"文件内容预览(前200字符): {content[:200]}") return False 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 def create_version_record(self) -> dict: diff --git a/.gitea/scripts/view_version_history.py b/.gitea/scripts/view_version_history.py index ace69f2..a419fb2 100644 --- a/.gitea/scripts/view_version_history.py +++ b/.gitea/scripts/view_version_history.py @@ -5,7 +5,6 @@ 用于查看和管理GUI客户端的版本历史记录 """ -import sys import json import argparse from pathlib import Path diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index 5364a79..9930f08 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -141,23 +141,43 @@ jobs: git config user.name "Gitea Actions Bot" 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 + Write-Host "Added config.py" 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 if ($LASTEXITCODE -ne 0) { # 动态获取当前分支名(兼容 master 和 develop) $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 - Write-Host "✅ Version changes committed and pushed to $BRANCH" + Write-Host "Version changes committed and pushed to $BRANCH" } else { - Write-Host "ℹ️ No changes to commit" + Write-Host "No changes to commit" } # Step 6: Display summary diff --git a/config.py b/config.py index 861edca..15c2f2b 100644 --- a/config.py +++ b/config.py @@ -42,7 +42,7 @@ VERSION = "1.0" WINDOW_TITLE = "AI回复连接入口-V1.0" # 应用版本号(用于版本检查) -APP_VERSION = "1.4.7" +APP_VERSION = "1.4.22" # 平台特定配置 PLATFORMS = { diff --git a/version_history.json b/version_history.json index c0d94ea..d9aa900 100644 --- a/version_history.json +++ b/version_history.json @@ -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", "update_type": "patch",