Skip to content

Commit 3ec116e

Browse files
committed
add DRY_RUN
1 parent 10788c0 commit 3ec116e

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎packages/opencode/script/publish.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const dir = fileURLToPath(new URL("..", import.meta.url))
88
process.chdir(dir)
99

1010
const { binaries } = await import("./build.ts")
11+
const dryRun = Boolean(process.env["DRY_RUN"])
1112
{
1213
const name = `${pkg.name}-${process.platform}-${process.arch}`
1314
console.log(`smoke test: running dist/${name}/bin/opencode --version`)
@@ -41,14 +42,23 @@ for (const [name] of Object.entries(binaries)) {
4142
if (process.platform !== "win32") {
4243
await $`chmod 755 -R .`
4344
}
45+
if (dryRun) {
46+
console.log(`DRY_RUN: skipping publish for ${name}`)
47+
continue
48+
}
4449
await $`bun publish --access public --tag ${Script.channel}`
4550
} finally {
4651
process.chdir(dir)
4752
}
4853
}
49-
await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${Script.channel}`
54+
if (dryRun) {
55+
console.log(`DRY_RUN: skipping publish for ${pkg.name}-ai`)
56+
}
57+
if (!dryRun) {
58+
await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${Script.channel}`
59+
}
5060

51-
if (!Script.preview) {
61+
if (!Script.preview && !dryRun) {
5262
const major = Script.version.split(".")[0]
5363
const majorTag = `latest-${major}`
5464
for (const [name] of Object.entries(binaries)) {
@@ -57,7 +67,7 @@ if (!Script.preview) {
5767
await $`cd ./dist/${pkg.name} && npm dist-tag add ${pkg.name}-ai@${Script.version} ${majorTag}`
5868
}
5969

60-
if (!Script.preview) {
70+
if (!Script.preview && !dryRun) {
6171
for (const key of Object.keys(binaries)) {
6272
await $`cd dist/${key}/bin && zip -r ../../${key}.zip *`
6373
}

0 commit comments

Comments
 (0)