Skip to content

Commit 4f650d4

Browse files
committed
fix: validate beta runtime index format
1 parent c0c2011 commit 4f650d4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/beta-desktop-runtime.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,23 @@ jobs:
134134
}
135135
)
136136
137-
$index | ConvertTo-Json -Depth 5 | Set-Content -Path $runtimeIndexPath -Encoding UTF8
137+
ConvertTo-Json -InputObject $index -Depth 5 | Set-Content -Path $runtimeIndexPath -Encoding UTF8
138+
139+
$env:RUNTIME_INDEX_PATH = $runtimeIndexPath
140+
$validateScript = @'
141+
import { readFileSync } from "node:fs";
142+
143+
const indexPath = process.env.RUNTIME_INDEX_PATH;
144+
if (!indexPath) {
145+
throw new Error("RUNTIME_INDEX_PATH is required");
146+
}
147+
148+
const value = JSON.parse(readFileSync(indexPath, "utf8"));
149+
if (!Array.isArray(value) || value.length !== 1) {
150+
throw new Error("runtime-release-index.json must contain exactly one release entry array");
151+
}
152+
'@
153+
node --input-type=module -e $validateScript
138154
139155
"runtime_zip_path=$runtimeZipPath" >> $env:GITHUB_OUTPUT
140156
"runtime_index_path=$runtimeIndexPath" >> $env:GITHUB_OUTPUT

0 commit comments

Comments
 (0)