Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(release): require Windows signature audit job

tianma-if7b680c2d90b6
diff --git a/scripts/release.mjs b/scripts/release.mjs
index 444bf74c..d55d4c85 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -698,6 +698,11 @@ const viewWorkflowRun = ({ repository, runId }) => ghJson([
"status,conclusion,url,headSha,jobs",
]);
+export const signedWindowsUpdateAuditPassed = (runView) =>
+ runView.jobs?.some(
+ (job) => job.name === "Audit signed Windows update" && job.conclusion === "success",
+ ) ?? false;
+
const waitForRerunStart = async ({ repository, runId }) => {
const deadline = Date.now() + 30_000;
while (Date.now() < deadline) {
@@ -1429,22 +1434,36 @@ const releaseMain = async (options) => {
androidReleaseReady,
]);
- if (desktopPlan.rebuild) {
- signDraftWindowsUpdate({ repository: options.repository, tag });
+ let windowsUpdateAuditRunId;
+ for (let attempt = 1; attempt <= 3; attempt += 1) {
+ if (desktopPlan.rebuild) {
+ signDraftWindowsUpdate({ repository: options.repository, tag });
+ }
+ windowsUpdateAuditRunId = await dispatchReleaseWorkflow({
+ repository: options.repository,
+ workflow: RELEASE_WORKFLOWS.desktop,
+ tag,
+ headSha: releaseSha,
+ });
+ checkpoint.windowsUpdateAuditRunId = windowsUpdateAuditRunId;
+ persistCheckpoint();
+ await waitForRun({
+ repository: options.repository,
+ runId: windowsUpdateAuditRunId,
+ label: "Draft signed Windows update audit",
+ });
+ const auditRun = viewWorkflowRun({
+ repository: options.repository,
+ runId: windowsUpdateAuditRunId,
+ });
+ if (signedWindowsUpdateAuditPassed(auditRun)) break;
+ if (!desktopPlan.rebuild || attempt === 3) {
+ throw new Error("Draft signed Windows update workflow completed without running its audit job.");
+ }
+ console.log(
+ "[release] desktop assets changed while preparing the signature; signing the latest manifest and retrying its audit",
+ );
}
- const windowsUpdateAuditRunId = await dispatchReleaseWorkflow({
- repository: options.repository,
- workflow: RELEASE_WORKFLOWS.desktop,
- tag,
- headSha: releaseSha,
- });
- checkpoint.windowsUpdateAuditRunId = windowsUpdateAuditRunId;
- persistCheckpoint();
- await waitForRun({
- repository: options.repository,
- runId: windowsUpdateAuditRunId,
- label: "Draft signed Windows update audit",
- });
const draft = ghJson([
"release",
diff --git a/scripts/release.test.mjs b/scripts/release.test.mjs
index e8cf3982..b40a43bc 100644
--- a/scripts/release.test.mjs
+++ b/scripts/release.test.mjs
@@ -16,6 +16,7 @@ import {
resolveReleaseVersion,
reusedAssetMatches,
selectPublishedDmg,
+ signedWindowsUpdateAuditPassed,
waitForRun,
} from "./release.mjs";
@@ -54,6 +55,18 @@ describe("release automation", () => {
expect(publication).toBeGreaterThan(audit);
});
+ test("requires the signed Windows audit job instead of accepting a rebuild-only workflow", () => {
+ expect(signedWindowsUpdateAuditPassed({
+ jobs: [{ name: "Audit signed Windows update", conclusion: "success" }],
+ })).toBe(true);
+ expect(signedWindowsUpdateAuditPassed({
+ jobs: [
+ { name: "Audit signed Windows update", conclusion: "skipped" },
+ { name: "Finalize desktop release assets", conclusion: "success" },
+ ],
+ })).toBe(false);
+ });
+
test("checks the offline Windows key before creating release state", () => {
const releaseSource = readFileSync(new URL("./release.mjs", import.meta.url), "utf8");
const releaseMain = releaseSource.indexOf("const releaseMain = async");