Co-authored-by: opencode <opencode@sst.dev>
This commit is contained in:
Dax
2026-01-29 13:17:55 -05:00
committed by GitHub
parent ae9199e101
commit 9ed3b0742f
27 changed files with 368 additions and 367 deletions

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bun
import { Script } from "@opencode-ai/script"
import { $ } from "bun"
if (!Script.preview) {
await $`gh release edit v${Script.version} --draft=false`
}
await $`bun install`
await $`gh release download --pattern "opencode-linux-*64.tar.gz" --pattern "opencode-darwin-*64.zip" -D dist`
await import(`../packages/opencode/script/publish-registries.ts`)

View File

@@ -32,16 +32,8 @@ Add highlights before publishing. Delete this section if no highlights.
`
let notes: string[] = []
console.log("=== publishing ===\n")
if (!Script.preview) {
const previous = await getLatestRelease()
notes = await buildNotes(previous, "HEAD")
// notes.unshift(highlightsTemplate)
}
const pkgjsons = await Array.fromAsync(
new Bun.Glob("**/package.json").scan({
absolute: true,
@@ -63,8 +55,22 @@ console.log("updated:", extensionToml)
await Bun.file(extensionToml).write(toml)
await $`bun install`
await import(`../packages/sdk/js/script/build.ts`)
console.log("\n=== opencode ===\n")
if (Script.release) {
const previous = await getLatestRelease()
const notes = await buildNotes(previous, "HEAD")
// notes.unshift(highlightsTemplate)
await $`git commit -am "release: v${Script.version}"`
await $`git tag v${Script.version}`
await $`git fetch origin`
await $`git cherry-pick HEAD..origin/dev`.nothrow()
await $`git push origin HEAD --tags --no-verify --force-with-lease`
await new Promise((resolve) => setTimeout(resolve, 5_000))
await $`gh release edit v${Script.version} --draft=false --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"}`
}
console.log("\n=== cli ===\n")
await import(`../packages/opencode/script/publish.ts`)
console.log("\n=== sdk ===\n")
@@ -75,22 +81,3 @@ await import(`../packages/plugin/script/publish.ts`)
const dir = new URL("..", import.meta.url).pathname
process.chdir(dir)
let output = `version=${Script.version}\n`
if (!Script.preview) {
await $`git commit -am "release: v${Script.version}"`
await $`git tag v${Script.version}`
await $`git fetch origin`
await $`git cherry-pick HEAD..origin/dev`.nothrow()
await $`git push origin HEAD --tags --no-verify --force-with-lease`
await new Promise((resolve) => setTimeout(resolve, 5_000))
await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz`
const release = await $`gh release view v${Script.version} --json id,tagName`.json()
output += `release=${release.id}\n`
output += `tag=${release.tagName}\n`
}
if (process.env.GITHUB_OUTPUT) {
await Bun.write(process.env.GITHUB_OUTPUT, output)
}

17
script/version.ts Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bun
import { Script } from "@opencode-ai/script"
import { $ } from "bun"
let output = [`version=${Script.version}`]
if (!Script.preview) {
await $`gh release create v${Script.version} -d --title "v${Script.version}" ${Script.preview ? "--prerelease" : ""}`
const release = await $`gh release view v${Script.version} --json id,tagName`.json()
output.push(`release=${release.id}`)
output.push(`tag=${release.tagName}`)
}
if (process.env.GITHUB_OUTPUT) {
await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n"))
}