From 3ab1c82a37da1653bfba77c61d7166389d8caada Mon Sep 17 00:00:00 2001 From: haosicheng Date: Sat, 11 Oct 2025 10:08:10 +0800 Subject: [PATCH] =?UTF-8?q?[patch]=20PDD=E7=99=BB=E5=BD=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81GUI=E5=9B=9E=E8=B0=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/gui-version-release.yml | 128 ++++++++++------------- 1 file changed, 53 insertions(+), 75 deletions(-) diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index 6db0c55..fd24188 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -9,33 +9,32 @@ jobs: runs-on: windows steps: - # Step 1: Gitea 原生检出(不依赖 GitHub) + # Step 1: Checkout repository - name: Checkout repository shell: powershell run: | - Write-Host "==========================================" - Write-Host "开始检出代码" - Write-Host "==========================================" - Write-Host "当前目录: $(Get-Location)" - Write-Host "分支: ${{ github.ref_name }}" - Write-Host "提交: ${{ github.sha }}" - Write-Host "作者: ${{ github.actor }}" - Write-Host "" + Write-Host "=========================================="; + Write-Host "Checking out repository"; + Write-Host "=========================================="; + Write-Host "Current directory: $(Get-Location)"; + Write-Host "Branch: ${{ github.ref_name }}"; + Write-Host "Commit: ${{ github.sha }}"; + Write-Host "Author: ${{ github.actor }}"; + Write-Host ""; - # Git 配置 - git config --global core.autocrlf false - git config --global core.longpaths true + git config --global core.autocrlf false; + git config --global core.longpaths true; - # 拉取最新代码 - Write-Host "拉取最新代码..." - git fetch origin - git checkout ${{ github.ref_name }} - git pull origin ${{ github.ref_name }} + Write-Host "Fetching latest code..."; + git fetch origin; + git checkout ${{ github.ref_name }}; + git pull origin ${{ github.ref_name }}; - Write-Host "" - Write-Host "Git 状态:" - git status - Write-Host "==========================================" + Write-Host ""; + Write-Host "Git status:"; + git status; + Write-Host "=========================================="; + # Step 2: Check Python environment - name: Check Python environment @@ -125,64 +124,43 @@ jobs: DB_PASSWORD: password_ee2iQ3 DB_PORT: 5400 - # Step 5: Commit changes back to repository + # Step 5: Commit version changes - name: Commit version changes if: success() shell: powershell run: | - Write-Host "Committing version changes..." + Write-Host "Committing version changes..."; - # Read version from config.py - $VERSION = "" + $VERSION = ""; if (Test-Path "config.py") { - $configContent = Get-Content "config.py" -Raw + $configContent = Get-Content "config.py" -Raw; if ($configContent -match 'APP_VERSION\s*=\s*"([\d.]+)"') { - $VERSION = $matches[1] - Write-Host "New version: $VERSION" + $VERSION = $matches[1]; + Write-Host "New version: $VERSION"; } } - # 配置 Git 用户(自动化提交) - git config user.name "Gitea Actions Bot" - git config user.email "bot@gitea.local" + git config user.name "Gitea Actions Bot"; + git config user.email "bot@gitea.local"; - # 检查文件状态 - Write-Host "=== Git Status Before Add ===" - git status + Write-Host "Adding files..."; + git add config.py; + git add version_history.json; - 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 "Checking changes..."; + git status; - # 添加修改的文件 - 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 + $hasChanges = git diff --staged --quiet; if ($LASTEXITCODE -ne 0) { - # 动态获取当前分支名(兼容 master 和 develop) - $BRANCH = "${{ github.ref_name }}" - Write-Host "`nCommitting to branch: $BRANCH" + $BRANCH = "${{ github.ref_name }}"; + Write-Host "Committing to branch: $BRANCH"; - git commit -m "[skip ci] Update version to v$VERSION" - git push origin $BRANCH + 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 "Changes committed and pushed"; } else { - Write-Host "No changes to commit" + Write-Host "No changes to commit"; } # Step 6: Display summary @@ -190,22 +168,22 @@ jobs: if: always() shell: powershell run: | - # Read version from config.py - $VERSION = "Unknown" + $VERSION = "Unknown"; if (Test-Path "config.py") { - $configContent = Get-Content "config.py" -Raw + $configContent = Get-Content "config.py" -Raw; if ($configContent -match 'APP_VERSION\s*=\s*"([\d.]+)"') { - $VERSION = $matches[1] + $VERSION = $matches[1]; } } - Write-Host "==========================================" - Write-Host "GUI Version Release Summary" - Write-Host "==========================================" - Write-Host "Author: ${{ github.actor }}" - Write-Host "Branch: ${{ github.ref_name }}" - Write-Host "Version: $VERSION" - Write-Host "Time: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" - Write-Host "Commit: ${{ github.sha }}" - Write-Host "==========================================" + Write-Host "=========================================="; + Write-Host "GUI Version Release Summary"; + Write-Host "=========================================="; + Write-Host "Author: ${{ github.actor }}"; + Write-Host "Branch: ${{ github.ref_name }}"; + Write-Host "Version: $VERSION"; + Write-Host "Time: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"; + Write-Host "Commit: ${{ github.sha }}"; + Write-Host "=========================================="; +