ci: avoid non-ascii PowerShell literals
Some checks failed
Build Windows Release / Build Windows x64 Release (push) Failing after 15s
Some checks failed
Build Windows Release / Build Windows x64 Release (push) Failing after 15s
This commit is contained in:
@@ -43,7 +43,7 @@ jobs:
|
|||||||
Expand-Archive -Path $zip -DestinationPath $work -Force
|
Expand-Archive -Path $zip -DestinationPath $work -Force
|
||||||
|
|
||||||
$src = Get-ChildItem -Path $work -Directory | Select-Object -First 1
|
$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
|
"SOURCE_DIR=$($src.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||||
Write-Host "Source dir: $($src.FullName)"
|
Write-Host "Source dir: $($src.FullName)"
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ jobs:
|
|||||||
|
|
||||||
$bash = "$msysRoot\usr\bin\bash.exe"
|
$bash = "$msysRoot\usr\bin\bash.exe"
|
||||||
& $bash -lc "pacman --noconfirm -Syuu"
|
& $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"
|
& $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"
|
& $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
|
- name: Configure and build
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
$version = if ($env:GITHUB_REF_TYPE -eq 'tag') { $env:GITHUB_REF_NAME } else { "build-$shortSha" }
|
$version = if ($env:GITHUB_REF_TYPE -eq 'tag') { $env:GITHUB_REF_NAME } else { "build-$shortSha" }
|
||||||
$zipName = "$env:PACKAGE_BASENAME-$version.zip"
|
$zipName = "$env:PACKAGE_BASENAME-$version.zip"
|
||||||
$dist = Join-Path $env:SOURCE_DIR 'dist-windows\chengnan'
|
$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)
|
Push-Location (Split-Path $dist -Parent)
|
||||||
if (Test-Path (Join-Path $env:SOURCE_DIR $zipName)) { Remove-Item -Force (Join-Path $env:SOURCE_DIR $zipName) }
|
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
|
Compress-Archive -Path 'chengnan\*' -DestinationPath (Join-Path $env:SOURCE_DIR $zipName) -Force
|
||||||
@@ -126,9 +126,9 @@ jobs:
|
|||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
if (-not (Test-Path $env:PACKAGE_ZIP)) { 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 不存在:$env:PACKAGE_SHA256" }
|
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 文件为空:$env:PACKAGE_ZIP" }
|
if ((Get-Item $env:PACKAGE_ZIP).Length -le 0) { throw "zip file is empty: $env:PACKAGE_ZIP" }
|
||||||
|
|
||||||
- name: Upload package to repository release
|
- name: Upload package to repository release
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -138,7 +138,7 @@ jobs:
|
|||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$token = $env:RELEASE_TOKEN
|
$token = $env:RELEASE_TOKEN
|
||||||
if ([string]::IsNullOrWhiteSpace($token)) { $token = $env:GITHUB_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' }
|
$serverUrl = if ($env:GITHUB_SERVER_URL) { $env:GITHUB_SERVER_URL.TrimEnd('/') } else { 'https://git.luochen570.cn' }
|
||||||
$repo = $env:GITHUB_REPOSITORY
|
$repo = $env:GITHUB_REPOSITORY
|
||||||
@@ -185,7 +185,7 @@ jobs:
|
|||||||
--output $responseFile `
|
--output $responseFile `
|
||||||
$uploadUrl
|
$uploadUrl
|
||||||
if ($status -ne '200' -and $status -ne '201') {
|
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 }
|
if (Test-Path $responseFile) { Get-Content $responseFile }
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user