ci: new publish method (#1451)

This commit is contained in:
Dax
2025-07-31 01:00:29 -04:00
committed by GitHub
parent b09ebf4645
commit 33cef075d2
190 changed files with 16142 additions and 13342 deletions

26
scripts/publish.ts Normal file → Executable file
View File

@@ -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`
}