chore(release): 交付物架构断言 + CHANGELOG 归置 v2.0.2
已公开发布的 nodeagent-win-arm64.zip 内装的其实是 x64 的 node.exe (两包内 node.exe 字节完全相同,PE Machine 均为 0x8664),该包在 ARM Windows 上 能启动、能 listen,却 TLS 握手不完成 —— 被控端实际不可用,而 macOS 侧 100% 复现不出。 - 新增 scripts/lib/zip-pe-arch.mjs:纯内置 zlib 手解 zip、读 PE 头判架构。 不依赖 unzip / Expand-Archive(Windows runner 上没有 unzip)。 含 CLI 自检入口,已注入故障实测会红(arm64 包去要 x64 期望 → 退出码 1)。 - release.mjs:生成资产前调用之,不符即中止发版 —— 拦在 tag/push 之前, 是「交付物本身」的断言,与 pack.mjs 的「流程内部」断言分两层。 - windows-e2e.yml:把原先内联的 PowerShell 校验实现改为复用同一模块, 消除两套实现各自漂移的可能。 - CHANGELOG:[未发布] 归入 v2.0.2。
This commit is contained in:
1 parent
87b74fd015
commit
f558e3e7df
4 files changed
+155
-18
No files matched your search
@@ -162,28 +162,13 @@ jobs:
|
||||
# 但 TLS 握手不完成**(客户端只见超时)→ 被控端实际不可用,且 macOS 侧 100% 测不出。
|
||||
# 根因是 pack.mjs 的运行时缓存文件名不含架构。这里直接验**最终产物**的 PE 架构,
|
||||
# 比只验脚本内部逻辑更靠近交付物(缓存串包 / 手工塞错文件都会被这一步拦下)。
|
||||
# 校验实现与发版脚本共用(scripts/lib/zip-pe-arch.mjs)—— 避免两套实现各自漂移。
|
||||
foreach ($arch in @('x64','arm64')) {
|
||||
node scripts/pack.mjs --arch $arch
|
||||
}
|
||||
$want = @{ 'x64' = [uint16]0x8664; 'arm64' = [uint16]0xaa64 }
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
foreach ($arch in @('x64','arm64')) {
|
||||
$zip = "release/nodeagent-win-$arch.zip"
|
||||
if (-not (Test-Path $zip)) { throw "zip not produced: $zip" }
|
||||
$z = [IO.Compression.ZipFile]::OpenRead((Resolve-Path $zip))
|
||||
try {
|
||||
$e = $z.Entries | Where-Object { $_.Name -eq 'node.exe' }
|
||||
if (-not $e) { throw "missing node.exe in $zip" }
|
||||
$s = $e.Open(); $buf = New-Object byte[] 4096
|
||||
[void]$s.Read($buf, 0, 4096); $s.Close()
|
||||
# PE 头:0x3c 处为 PE 签名偏移,+4 为 Machine 字段
|
||||
$peOff = [BitConverter]::ToUInt32($buf, 0x3c)
|
||||
$machine = [BitConverter]::ToUInt16($buf, [int]$peOff + 4)
|
||||
if ($machine -ne $want[$arch]) {
|
||||
throw "node.exe arch mismatch in $zip : want 0x$('{0:x}' -f $want[$arch]) got 0x$('{0:x}' -f $machine)"
|
||||
}
|
||||
Write-Host "OK - $arch -> node.exe PE machine 0x$('{0:x}' -f $machine)"
|
||||
} finally { $z.Dispose() }
|
||||
node scripts/lib/zip-pe-arch.mjs "release/nodeagent-win-$arch.zip" $arch
|
||||
if ($LASTEXITCODE -ne 0) { throw "node.exe 架构校验失败($arch)—— 严禁发布该包" }
|
||||
}
|
||||
- name: 冒烟 — 被控端监听
|
||||
shell: pwsh
|
||||
|
||||
Reference in new issue
Block a user