publish.ts 550 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bun
  2. const dir = new URL("..", import.meta.url).pathname
  3. process.chdir(dir)
  4. import { $ } from "bun"
  5. const version = process.env["OPENCODE_VERSION"]
  6. if (!version) {
  7. throw new Error("OPENCODE_VERSION is required")
  8. }
  9. await import("./generate")
  10. const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
  11. await $`bun pm version --allow-same-version --no-git-tag-version ${version}`
  12. if (snapshot) {
  13. await $`bun publish --tag snapshot`
  14. }
  15. if (!snapshot) {
  16. await $`bun publish`
  17. }
  18. await $`bun pm version 0.0.0 --no-git-tag-version`