Skip to content

Commit 54e969e

Browse files
authored
fix(release): satisfy npm provenance so packages actually publish (#18)
The publish run went green while every npm publish silently failed with E422: provenance validation requires repository.url to match the repo the workflow runs from, and the generated platform/meta manifests had no repository field at all (the sdk and plugin manifests likewise), while the root and launcher manifests pointed at the wrong-case repo path. - stamp repository into the generated platform and wrapper manifests - add repository to the sdk and plugin packages - normalize existing repository URLs to the canonical lowercase path - release orchestration now records per-section failures and exits non-zero, so a green publish run means packages really shipped
1 parent c6d8242 commit 54e969e

7 files changed

Lines changed: 40 additions & 5 deletions

File tree

backend/cli/script/build.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ for (const item of targets) {
189189
version: Script.version,
190190
os: [item.os],
191191
cpu: [item.arch],
192+
// npm provenance refuses packages whose repository.url doesn't match
193+
// the repo the workflow ran from (case-sensitive)
194+
repository: {
195+
type: "git",
196+
url: "git+https://github.com/synthetic-sciences/openscience.git",
197+
},
192198
},
193199
null,
194200
2,

backend/cli/script/publish.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
3939
postinstall: "bun ./postinstall.mjs || node ./postinstall.mjs",
4040
},
4141
version: version,
42+
// npm provenance refuses packages whose repository.url doesn't match
43+
// the repo the workflow ran from (case-sensitive)
44+
repository: {
45+
type: "git",
46+
url: "git+https://github.com/synthetic-sciences/openscience.git",
47+
},
4248
optionalDependencies: binaries,
4349
},
4450
null,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
},
8282
"repository": {
8383
"type": "git",
84-
"url": "https://github.com/synthetic-sciences/OpenScience"
84+
"url": "https://github.com/synthetic-sciences/openscience"
8585
},
8686
"license": "Apache-2.0",
8787
"prettier": {

tooling/launcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"repository": {
2424
"type": "git",
25-
"url": "git+https://github.com/synthetic-sciences/OpenScience.git"
25+
"url": "git+https://github.com/synthetic-sciences/openscience.git"
2626
},
2727
"homepage": "https://syntheticsciences.ai"
2828
}

tooling/plugin/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424
"@types/node": "catalog:",
2525
"typescript": "catalog:",
2626
"@typescript/native-preview": "catalog:"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "git+https://github.com/synthetic-sciences/openscience.git"
2731
}
28-
}
32+
}

tooling/repo/publish.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,33 @@ if (Script.release) {
5959
await $`gh release edit v${Script.version} --draft=false`.nothrow()
6060
}
6161

62+
// Sections keep publishing past an earlier failure so a broken CLI publish
63+
// doesn't block the SDK, but any failure must fail the workflow at the end —
64+
// a green run previously meant nothing reached npm at all.
65+
const failures: string[] = []
66+
6267
console.log("\n=== cli ===\n")
6368
try {
6469
await import(`../../backend/cli/script/publish.ts`)
6570
} catch (e) {
6671
console.error("CLI publish failed:", e)
72+
failures.push("cli")
6773
}
6874

6975
console.log("\n=== sdk ===\n")
7076
try {
7177
await import(`../sdk/js/script/publish.ts`)
7278
} catch (e) {
7379
console.error("SDK publish failed:", e)
80+
failures.push("sdk")
7481
}
7582

7683
console.log("\n=== plugin ===\n")
7784
try {
7885
await import(`../plugin/script/publish.ts`)
7986
} catch (e) {
8087
console.error("Plugin publish failed:", e)
88+
failures.push("plugin")
8189
}
8290

8391
console.log("\n=== launcher (openscience) ===\n")
@@ -104,10 +112,17 @@ try {
104112
// without polluting node_modules/.bin in the npx temp tree.
105113
delete launcherPkg.dependencies
106114
await Bun.file(`${launcherDir}/package.json`).write(JSON.stringify(launcherPkg, null, 2))
107-
await $`cd ${launcherDir} && npm publish --access public --tag ${Script.channel}`.nothrow()
115+
const result = await $`cd ${launcherDir} && npm publish --access public --tag ${Script.channel}`.nothrow()
116+
if (result.exitCode !== 0) throw new Error(`npm publish exited with ${result.exitCode}`)
108117
} catch (e) {
109118
console.error("Launcher publish failed:", e)
119+
failures.push("launcher")
110120
}
111121

112122
const dir = new URL("../..", import.meta.url).pathname
113123
process.chdir(dir)
124+
125+
if (failures.length > 0) {
126+
console.error(`\npublish failed for: ${failures.join(", ")}`)
127+
process.exit(1)
128+
}

tooling/sdk/js/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@
2929
"dependencies": {},
3030
"publishConfig": {
3131
"directory": "dist"
32+
},
33+
"repository": {
34+
"type": "git",
35+
"url": "git+https://github.com/synthetic-sciences/openscience.git"
3236
}
33-
}
37+
}

0 commit comments

Comments
 (0)