2026-01-29 18:17:55 +00:00
|
|
|
#!/usr/bin/env bun
|
|
|
|
|
|
|
|
|
|
import { Script } from "@opencode-ai/script"
|
|
|
|
|
import { $ } from "bun"
|
|
|
|
|
|
2026-01-30 05:43:36 +00:00
|
|
|
const output = [`version=${Script.version}`]
|
2026-01-29 18:17:55 +00:00
|
|
|
|
|
|
|
|
if (!Script.preview) {
|
2026-03-24 22:24:34 +00:00
|
|
|
await $`opencode run --command changelog`.cwd(process.cwd())
|
|
|
|
|
const file = `${process.cwd()}/UPCOMING_CHANGELOG.md`
|
|
|
|
|
const body = await Bun.file(file)
|
|
|
|
|
.text()
|
|
|
|
|
.catch(() => "No notable changes")
|
2026-01-30 06:15:24 +00:00
|
|
|
const dir = process.env.RUNNER_TEMP ?? "/tmp"
|
2026-03-24 22:24:34 +00:00
|
|
|
const notesFile = `${dir}/opencode-release-notes.txt`
|
|
|
|
|
await Bun.write(notesFile, body)
|
|
|
|
|
await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes-file ${notesFile}`
|
2026-02-03 08:59:34 +00:00
|
|
|
const release = await $`gh release view v${Script.version} --json tagName,databaseId`.json()
|
|
|
|
|
output.push(`release=${release.databaseId}`)
|
2026-01-29 18:17:55 +00:00
|
|
|
output.push(`tag=${release.tagName}`)
|
2026-02-20 14:33:21 +00:00
|
|
|
} else if (Script.channel === "beta") {
|
|
|
|
|
await $`gh release create v${Script.version} -d --title "v${Script.version}" --repo ${process.env.GH_REPO}`
|
|
|
|
|
const release =
|
|
|
|
|
await $`gh release view v${Script.version} --json tagName,databaseId --repo ${process.env.GH_REPO}`.json()
|
|
|
|
|
output.push(`release=${release.databaseId}`)
|
|
|
|
|
output.push(`tag=${release.tagName}`)
|
2026-01-29 18:17:55 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-20 14:33:21 +00:00
|
|
|
output.push(`repo=${process.env.GH_REPO}`)
|
|
|
|
|
|
2026-01-29 18:17:55 +00:00
|
|
|
if (process.env.GITHUB_OUTPUT) {
|
|
|
|
|
await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n"))
|
|
|
|
|
}
|
2026-01-30 06:15:24 +00:00
|
|
|
|
|
|
|
|
process.exit(0)
|