summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/js/script/publish.ts
blob: 39407f633a1766740a13cd4141e29175ea9f5c29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bun

const dir = new URL("..", import.meta.url).pathname
process.chdir(dir)

import { $ } from "bun"

const version = process.env["OPENCODE_VERSION"]
if (!version) {
  throw new Error("OPENCODE_VERSION is required")
}

await import("./generate")

const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"

await $`bun pm version --allow-same-version --no-git-tag-version ${version}`
if (snapshot) {
  await $`bun publish --tag snapshot`
}
if (!snapshot) {
  await $`bun publish`
}
await $`bun pm version 0.0.0 --no-git-tag-version`