发布流程:修 Release 中文乱码,补安装版与便携版分发

PowerShell 5.1 的 Invoke-RestMethod 传字符串 body 会按 ISO-8859-1 编码,Release 标题/正文的中文全变成 ?;改为 UTF-8 字节 + charset,并对已有 Release 做 PATCH。build.bat 生成便携版 zip 并把它的 SHA256 补进 SHA256SUMS,发布脚本同时上传 setup 安装包与便携版 zip(Gitea Release 附件实测接受 .exe)。新增 -MetadataOnly 只刷新文案;修 build.bat 读 mygo.json 未指定 UTF8 导致版本号取空的问题。
This commit is contained in:
zerorigin2019 committed 2026-11-16 10:40:39 +08:00
1 parent 534b5555a7
commit b36b1ca071
4 files changed
+102 -21

No files matched your search

+13
View File
@@ -48,8 +48,21 @@ if not exist portable mkdir portable
copy /y bin\windows-amd64\ZerOriginTool.exe portable\ZerOriginTool.exe >nul
copy /y bin\windows-amd64\watchdog.exe portable\watchdog.exe >nul
rem 便携版压缩包:新用户下载解压即用。自更新用的 tar.gz 也能解压,但文件名和内容(.mygo-files)
rem 是给更新器看的,不适合当分发物。
rem 注意 -Encoding UTF8:mygo.json 是 UTF-8(含中文),不加会被按 GBK 读成乱码导致 ConvertFrom-Json 失败。
for /f "tokens=*" %%v in ('powershell -NoProfile -Command "(Get-Content mygo.json -Raw -Encoding UTF8 | ConvertFrom-Json).version"') do set "APPVER=%%v"
if not defined APPVER set "APPVER=0.0.0"
powershell -NoProfile -Command "Compress-Archive -Path 'portable\ZerOriginTool.exe','portable\watchdog.exe','portable\README.txt' -DestinationPath ('bin\windows-amd64\zerorigin-toolbox-' + $env:APPVER + '-windows-amd64-portable.zip') -Force"
if errorlevel 1 echo [build] 便携版压缩包生成失败(不影响其他产物)
rem 便携版压缩包也记进 bin\SHA256SUMS(mygo 写校验和时 zip 还不存在),方便用户校验下载。
for /f "tokens=*" %%h in ('powershell -NoProfile -Command "(Get-FileHash (Join-Path 'bin\windows-amd64' ('zerorigin-toolbox-' + $env:APPVER + '-windows-amd64-portable.zip')) -Algorithm SHA256).Hash.ToLower()"') do set "ZIPHASH=%%h"
if defined ZIPHASH echo %ZIPHASH% zerorigin-toolbox-%APPVER%-windows-amd64-portable.zip>>bin\SHA256SUMS
echo [build] 完成,产物:
dir /b bin\windows-amd64\*.exe
dir /b bin\windows-amd64\*.zip 2>nul
echo 便携版:portable\
exit /b 0