fix: write git tag/commit messages via UTF-8 -F file
All checks were successful
技能自动化发布 / release (push) Successful in 5s

This commit is contained in:
2026-08-18 10:16:33 +08:00
parent 81096051dd
commit a11cdf4e7e
4 changed files with 31 additions and 10 deletions

View File

@@ -9,10 +9,14 @@
- 小节正文写用户能看懂的变化(新能力、修复、注意事项),避免堆砌内部实现细节 - 小节正文写用户能看懂的变化(新能力、修复、注意事项),避免堆砌内部实现细节
- 打 tag 前**必须**为即将发布的版本新增一节;找不到匹配小节时,本次发布不会更新 changelog 字段 - 打 tag 前**必须**为即将发布的版本新增一节;找不到匹配小节时,本次发布不会更新 changelog 字段
## 1.0.87
- `release.ps1` 打 annotated tag / 自动 commit 改为 UTF-8 消息文件 + `git -F`,避免 Windows PowerShell 按控制台代码页编码 `-m` 参数
- 验收时 Gitea tag 说明应为「正式发布」,而不是「姝e紡鍙戝竷」;不改写已发布的历史 tag(含 v1.0.86)
## 1.0.86 ## 1.0.86
- 修复 `release.ps1` 在中文 Windows 下经 `cmd /c` 打 annotated tag 时,默认说明「正式发布」被 OEM 代码页转成乱码的问题 - 去掉 `release.ps1` 里通过 `cmd /c` 调 git 的写法;中文 tag 说明在部分 Windows 控制台代码页下仍可能乱码,见 1.0.87
- 改为直接调用 `git.exe` 并按参数数组传 `-m`,commit / tag 中文说明保持 UTF-8;不改写历史 tag
## 1.0.85 ## 1.0.85

View File

@@ -1,7 +1,7 @@
--- ---
name: 技能开发模板(通用业务版) name: 技能开发模板(通用业务版)
description: "OpenClaw 通用业务技能开发模板,供复制后定制新业务 skill。定制步骤见 development/DEVELOPMENT.md。" description: "OpenClaw 通用业务技能开发模板,供复制后定制新业务 skill。定制步骤见 development/DEVELOPMENT.md。"
version: 1.0.86 version: 1.0.87
author: 深圳匠厂科技有限公司 author: 深圳匠厂科技有限公司
metadata: metadata:
openclaw: openclaw:

View File

@@ -45,9 +45,11 @@ function Convert-GitOutputLines {
) )
} }
# Call git.exe directly. Do not wrap with `cmd /c` — on Chinese Windows, cmd # Call git.exe directly. Never wrap with `cmd /c`: on Chinese Windows, cmd
# re-encodes -m / -F arguments through the OEM code page and garbles UTF-8 # re-encodes the command line through the OEM code page.
# annotated tag / commit messages (e.g. 「正式发布」 → 「姝e紡鍙戝竷」). # Also never pass Chinese via `git -m`: Windows PowerShell 5.1 encodes native
# argv using the console code page, so 「正式发布」 becomes 「姝e紡鍙戝竷」
# in the annotated tag. Commit/tag messages go through a UTF-8 file + `-F`.
function Invoke-GitRaw { function Invoke-GitRaw {
param([Parameter(Mandatory = $true)][string[]]$GitArgs) param([Parameter(Mandatory = $true)][string[]]$GitArgs)
$prev = $ErrorActionPreference $prev = $ErrorActionPreference
@@ -73,6 +75,21 @@ function Invoke-Git {
} }
} }
function Invoke-GitWithMessageFile {
param(
[Parameter(Mandatory = $true)][string[]]$GitArgsPrefix,
[Parameter(Mandatory = $true)][string]$Message
)
$msgFile = Join-Path ([System.IO.Path]::GetTempPath()) ("jiangchang-git-msg-" + [guid]::NewGuid().ToString("N") + ".txt")
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
[System.IO.File]::WriteAllText($msgFile, ($Message.TrimEnd() + "`n"), $utf8NoBom)
try {
Invoke-Git -GitArgs (@("-c", "i18n.commitEncoding=utf-8") + $GitArgsPrefix + @("-F", $msgFile))
} finally {
Remove-Item -LiteralPath $msgFile -Force -ErrorAction SilentlyContinue
}
}
function Get-GitOutput { function Get-GitOutput {
param([Parameter(Mandatory = $true)][string[]]$GitArgs) param([Parameter(Mandatory = $true)][string[]]$GitArgs)
$r = Invoke-GitRaw -GitArgs $GitArgs $r = Invoke-GitRaw -GitArgs $GitArgs
@@ -229,7 +246,7 @@ function Ensure-CleanOrAutoCommit {
} }
Invoke-Git -GitArgs @("add", "-A") Invoke-Git -GitArgs @("add", "-A")
Invoke-Git -GitArgs @("commit", "-m", $commitMsg) Invoke-GitWithMessageFile -GitArgsPrefix @("commit") -Message $commitMsg
} }
try { try {
@@ -289,13 +306,13 @@ try {
} }
if ($DryRun) { if ($DryRun) {
Write-Host "[DryRun] Would run: git tag -a $nextTag -m `"$Message`"" -ForegroundColor Yellow Write-Host "[DryRun] Would run: git tag -a $nextTag -F <utf8-msg-file> ($Message)" -ForegroundColor Yellow
Write-Host "[DryRun] Would run: git push origin $nextTag" -ForegroundColor Yellow Write-Host "[DryRun] Would run: git push origin $nextTag" -ForegroundColor Yellow
Write-Host "=== DryRun Complete ===" -ForegroundColor Cyan Write-Host "=== DryRun Complete ===" -ForegroundColor Cyan
exit 0 exit 0
} }
Invoke-Git -GitArgs @("tag", "-a", $nextTag, "-m", $Message) Invoke-GitWithMessageFile -GitArgsPrefix @("tag", "-a", $nextTag) -Message $Message
Invoke-Git -GitArgs @("push", "origin", $nextTag) Invoke-Git -GitArgs @("push", "origin", $nextTag)
Write-Host "Release success: $nextTag" -ForegroundColor Green Write-Host "Release success: $nextTag" -ForegroundColor Green

View File

@@ -1,6 +1,6 @@
"""技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。""" """技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。"""
SKILL_SLUG = "your-skill-slug" SKILL_SLUG = "your-skill-slug"
SKILL_VERSION = "1.0.86" SKILL_VERSION = "1.0.87"
LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug" LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug"
PLATFORM_KIT_MIN_VERSION = "1.2.11" PLATFORM_KIT_MIN_VERSION = "1.2.11"