diff --git a/.gitea/workflows/build-windows-release.yml b/.gitea/workflows/build-windows-release.yml index 987e398..1fc60e9 100644 --- a/.gitea/workflows/build-windows-release.yml +++ b/.gitea/workflows/build-windows-release.yml @@ -43,7 +43,7 @@ jobs: Expand-Archive -Path $zip -DestinationPath $work -Force $src = Get-ChildItem -Path $work -Directory | Select-Object -First 1 - if (-not $src) { throw '源码压缩包解压后没有目录' } + if (-not $src) { throw 'Source archive extraction produced no directory' } "SOURCE_DIR=$($src.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 Write-Host "Source dir: $($src.FullName)" @@ -62,11 +62,11 @@ jobs: $bash = "$msysRoot\usr\bin\bash.exe" & $bash -lc "pacman --noconfirm -Syuu" - if ($LASTEXITCODE -ne 0) { Write-Host '第一次 pacman 系统更新返回非零,继续执行第二次更新。' } + if ($LASTEXITCODE -ne 0) { Write-Host 'First pacman system update returned non-zero; continuing with second update.' } & $bash -lc "pacman --noconfirm -Syuu" - if ($LASTEXITCODE -ne 0) { throw "pacman 系统更新失败,退出码:$LASTEXITCODE" } + if ($LASTEXITCODE -ne 0) { throw "pacman system update failed, exit code: $LASTEXITCODE" } & $bash -lc "pacman --noconfirm -S --needed git zip unzip p7zip mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-qt6-base mingw-w64-ucrt-x86_64-qt6-imageformats" - if ($LASTEXITCODE -ne 0) { throw "pacman 安装依赖失败,退出码:$LASTEXITCODE" } + if ($LASTEXITCODE -ne 0) { throw "pacman dependency installation failed, exit code: $LASTEXITCODE" } - name: Configure and build shell: powershell @@ -108,7 +108,7 @@ jobs: $version = if ($env:GITHUB_REF_TYPE -eq 'tag') { $env:GITHUB_REF_NAME } else { "build-$shortSha" } $zipName = "$env:PACKAGE_BASENAME-$version.zip" $dist = Join-Path $env:SOURCE_DIR 'dist-windows\chengnan' - if (-not (Test-Path "$dist\chengnan.exe")) { throw "缺少构建产物:$dist\chengnan.exe" } + if (-not (Test-Path "$dist\chengnan.exe")) { throw "Missing build output: $dist\chengnan.exe" } Push-Location (Split-Path $dist -Parent) if (Test-Path (Join-Path $env:SOURCE_DIR $zipName)) { Remove-Item -Force (Join-Path $env:SOURCE_DIR $zipName) } Compress-Archive -Path 'chengnan\*' -DestinationPath (Join-Path $env:SOURCE_DIR $zipName) -Force @@ -126,9 +126,9 @@ jobs: shell: powershell run: | $ErrorActionPreference = 'Stop' - if (-not (Test-Path $env:PACKAGE_ZIP)) { throw "zip 不存在:$env:PACKAGE_ZIP" } - if (-not (Test-Path $env:PACKAGE_SHA256)) { throw "sha256 不存在:$env:PACKAGE_SHA256" } - if ((Get-Item $env:PACKAGE_ZIP).Length -le 0) { throw "zip 文件为空:$env:PACKAGE_ZIP" } + if (-not (Test-Path $env:PACKAGE_ZIP)) { throw "zip does not exist: $env:PACKAGE_ZIP" } + if (-not (Test-Path $env:PACKAGE_SHA256)) { throw "sha256 does not exist: $env:PACKAGE_SHA256" } + if ((Get-Item $env:PACKAGE_ZIP).Length -le 0) { throw "zip file is empty: $env:PACKAGE_ZIP" } - name: Upload package to repository release shell: powershell @@ -138,7 +138,7 @@ jobs: $ErrorActionPreference = 'Stop' $token = $env:RELEASE_TOKEN if ([string]::IsNullOrWhiteSpace($token)) { $token = $env:GITHUB_TOKEN } - if ([string]::IsNullOrWhiteSpace($token)) { throw '缺少发布 Token:请在仓库 Secrets 中配置 RELEASE_TOKEN,或确保 Gitea Actions 提供 GITHUB_TOKEN。' } + if ([string]::IsNullOrWhiteSpace($token)) { throw 'Missing release token. Configure RELEASE_TOKEN in repository secrets or ensure GITHUB_TOKEN is available.' } $serverUrl = if ($env:GITHUB_SERVER_URL) { $env:GITHUB_SERVER_URL.TrimEnd('/') } else { 'https://git.luochen570.cn' } $repo = $env:GITHUB_REPOSITORY @@ -185,7 +185,7 @@ jobs: --output $responseFile ` $uploadUrl if ($status -ne '200' -and $status -ne '201') { - Write-Error "上传 Release 附件失败,HTTP $status:$name" + Write-Error "Upload release asset failed, HTTP $status: $name" if (Test-Path $responseFile) { Get-Content $responseFile } exit 1 }