Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
ci(release): read stdin without readFileSync(0) in the promote scripts
EtienneLescot00f332b62cb8
diff --git a/.github/scripts/previous-stable-tag.mjs b/.github/scripts/previous-stable-tag.mjsindex 6b42864e9..768a2897a 100644--- a/.github/scripts/previous-stable-tag.mjs+++ b/.github/scripts/previous-stable-tag.mjs@@ -12,8 +12,10 @@// keeps the RC notes' `git log <tag>..` from dying on `unknown revision`, as// v1.9.4-rc.1's did when the guess named a 1.9.3 that never shipped.-import { readFileSync } from "node:fs";-import { argv } from "node:process";+import { argv, stdin } from "node:process";+// Not readFileSync(0): on a non-blocking stdin it throws EAGAIN instead of waiting,+// which failed promote.yml's main sync at v2.1.2. The stream waits for the data.+import { text } from "node:stream/consumers";const STABLE_TAG = /^v(\d+)\.(\d+)\.(\d+)$/;@@ -37,5 +39,5 @@ export function previousStableTag(version, tags) {// Only run when invoked directly, so the test can import the function.if (import.meta.filename === argv[1]) {- console.log(previousStableTag(argv[2], readFileSync(0, "utf8").split(/\s+/)));+ console.log(previousStableTag(argv[2], (await text(stdin)).split(/\s+/)));}diff --git a/.github/scripts/release-unsynced-fixes.mjs b/.github/scripts/release-unsynced-fixes.mjsindex 918be6085..c0c5ed1d4 100644--- a/.github/scripts/release-unsynced-fixes.mjs+++ b/.github/scripts/release-unsynced-fixes.mjs@@ -8,8 +8,10 @@// names it instead of leaving it behind. A cherry-pick resolved differently from its// original also shows up here: `git cherry` matches on the patch, not the subject.-import { readFileSync } from "node:fs";-import { argv } from "node:process";+import { argv, stdin } from "node:process";+// Not readFileSync(0): on a non-blocking stdin it throws EAGAIN instead of waiting,+// which failed promote.yml's main sync at v2.1.2. The stream waits for the data.+import { text } from "node:stream/consumers";const VERSION_BUMP = /^chore\(release\): bump to /;@@ -27,5 +29,5 @@ export function unsyncedFixes(cherry) {// Only run when invoked directly, so the test can import the function.if (import.meta.filename === argv[1]) {- for (const commit of unsyncedFixes(readFileSync(0, "utf8"))) console.log(commit);+ for (const commit of unsyncedFixes(await text(stdin))) console.log(commit);}diff --git a/.github/scripts/release-unsynced-fixes.test.mjs b/.github/scripts/release-unsynced-fixes.test.mjsindex 8aaadbd93..315c34dfc 100644--- a/.github/scripts/release-unsynced-fixes.test.mjs+++ b/.github/scripts/release-unsynced-fixes.test.mjs@@ -1,3 +1,5 @@+import { spawn } from "node:child_process";+import { fileURLToPath } from "node:url";import { describe, expect, it } from "vitest";import { unsyncedFixes } from "./release-unsynced-fixes.mjs";@@ -34,4 +36,16 @@ describe("unsyncedFixes", () => {it("finds nothing in empty input", () => {expect(unsyncedFixes("")).toEqual([]);});++ it("waits for stdin that arrives late, as `git cherry` writes it", async () => {+ const script = fileURLToPath(new URL("./release-unsynced-fixes.mjs", import.meta.url));+ const child = spawn(process.execPath, [script]);+ let out = "";+ child.stdout.on("data", (chunk) => {+ out += chunk;+ });+ setTimeout(() => child.stdin.end("+ 0a1b2c3d4 fix(export): release branch only\n"), 200);+ const code = await new Promise((resolve) => child.on("close", resolve));+ expect({ code, out }).toEqual({ code: 0, out: "0a1b2c3d4 fix(export): release branch only\n" });+ });});diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.ymlindex d72b31c20..97f04bb7c 100644--- a/.github/workflows/promote.yml+++ b/.github/workflows/promote.yml@@ -170,7 +170,8 @@ jobs:BRANCH="release/v${STABLE_VERSION}"git fetch origin main "$BRANCH"main_version() {- git show origin/main:package.json | node -p 'JSON.parse(require("fs").readFileSync(0, "utf8")).version'+ # An argument, not stdin: readFileSync(0) can throw EAGAIN on a CI pipe.+ node -p 'JSON.parse(process.argv[1]).version' "$(git show origin/main:package.json)"}# At or past the release, not just equal: promoting an older version after a# newer one must not set main back.