summaryrefslogtreecommitdiffhomepage
path: root/scripts/publish.ts
diff options
context:
space:
mode:
authorDax <[email protected]>2025-07-31 01:00:29 -0400
committerGitHub <[email protected]>2025-07-31 01:00:29 -0400
commit33cef075d228e80aefb44671ec68e1989c2855a8 (patch)
treed43a5c1bcc40d4d938eacccfd923c80301706cf1 /scripts/publish.ts
parentb09ebf464552f3899120b22c7a8572669000a554 (diff)
downloadopencode-33cef075d228e80aefb44671ec68e1989c2855a8.tar.gz
opencode-33cef075d228e80aefb44671ec68e1989c2855a8.zip
ci: new publish method (#1451)
Diffstat (limited to 'scripts/publish.ts')
-rwxr-xr-x[-rw-r--r--]scripts/publish.ts26
1 files changed, 22 insertions, 4 deletions
diff --git a/scripts/publish.ts b/scripts/publish.ts
index 2ec476059..13716b014 100644..100755
--- a/scripts/publish.ts
+++ b/scripts/publish.ts
@@ -2,9 +2,27 @@
import { $ } from "bun"
-import pkg from "../package.json"
+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
-const version = process.env["VERSION"]
+await import(`../packages/opencode/script/publish.ts`)
+await import(`../packages/sdk/stainless/generate.ts`)
+await import(`../packages/sdk/js/script/publish.ts`)
-console.log("publishing stainless")
-await import("./stainless.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`
+}