fix(release): run release scripts as main on Windows runners (#4474)

The ESM main-module guard compared import.meta.url with "file://" + process.argv[1],
which never matches on Windows (file://D:\a\... vs file:///D:/a/...). On the Windows
desktop release job, scripts/github-release.mjs therefore printed nothing and
gh release upload received an empty release lookup ("release not found"), leaving
v0.8.0-beta.1 without a Windows build. Compare resolved paths instead, shared by
every release script that runs as a CLI.
This commit is contained in:
Mohamed Boudra
2026-09-08 11:07:13 +02:00
committed by GitHub
parent f809651876
commit 47171b419b
7 changed files with 54 additions and 5 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import { execFileSync as nodeExecFileSync } from "node:child_process";
import { isMainModule } from "./is-main-module.mjs";
function parseJson(output) {
return JSON.parse(output);
@@ -67,7 +68,7 @@ function parseArgs(argv) {
return { cleanupDuplicates, repo, tag };
}
if (import.meta.url === `file://${process.argv[1]}`) {
if (isMainModule(import.meta.url)) {
const { cleanupDuplicates, repo, tag } = parseArgs(process.argv.slice(2));
let release = null;
for (let attempt = 0; attempt < 5 && !release; attempt += 1) {