summaryrefslogtreecommitdiffhomepage
path: root/script/publish.ts
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-07-31 01:25:24 -0400
committerDax Raad <[email protected]>2025-07-31 01:25:24 -0400
commit2d9ed06367516daa184ecf70bb0b2451c06da8d1 (patch)
treee735b78999853aa52d77240a4be7d32e0d09556e /script/publish.ts
parent50be2aee39289b7e05299e61d53478736ab914cc (diff)
downloadopencode-2d9ed06367516daa184ecf70bb0b2451c06da8d1.tar.gz
opencode-2d9ed06367516daa184ecf70bb0b2451c06da8d1.zip
ci: scripts
Diffstat (limited to 'script/publish.ts')
-rwxr-xr-xscript/publish.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/script/publish.ts b/script/publish.ts
new file mode 100755
index 000000000..13716b014
--- /dev/null
+++ b/script/publish.ts
@@ -0,0 +1,28 @@
+#!/usr/bin/env bun
+
+import { $ } from "bun"
+
+const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
+const version = snapshot
+ ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
+ : process.env["OPENCODE_VERSION"]
+if (!version) {
+ throw new Error("OPENCODE_VERSION is required")
+}
+process.env["OPENCODE_VERSION"] = version
+
+await import(`../packages/opencode/script/publish.ts`)
+await import(`../packages/sdk/stainless/generate.ts`)
+await import(`../packages/sdk/js/script/publish.ts`)
+
+if (!snapshot) {
+ await $`git commit -am "Release v${version}"`
+ await $`git tag v${version}`
+ await $`git push origin HEAD --tags`
+}
+if (snapshot) {
+ await $`git commit --allow-empty -m "Snapshot release v${version}"`
+ await $`git tag v${version}`
+ await $`git push origin v${version}`
+ await $`git reset --soft HEAD~1`
+}