version.ts 862 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bun
  2. import { Script } from "@opencode-ai/script"
  3. import { $ } from "bun"
  4. import { buildNotes, getLatestRelease } from "./changelog"
  5. const output = [`version=${Script.version}`]
  6. if (!Script.preview) {
  7. await $`gh release create v${Script.version} -d --title "v${Script.version}" ${Script.preview ? "--prerelease" : ""}`
  8. const release = await $`gh release view v${Script.version} --json id,tagName`.json()
  9. const previous = await getLatestRelease(Script.version)
  10. const notes = await buildNotes(previous, "HEAD")
  11. const body = notes.join("\n") || "No notable changes"
  12. await $`gh release edit v${Script.version} --title "v${Script.version}" --notes ${body}`
  13. output.push(`release=${release.id}`)
  14. output.push(`tag=${release.tagName}`)
  15. }
  16. if (process.env.GITHUB_OUTPUT) {
  17. await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n"))
  18. }