This commit is contained in:
Dax Raad 2025-07-31 00:24:51 -04:00
parent d0a81a02ef
commit 4a07d7ecd3
6 changed files with 21 additions and 56 deletions

View file

@ -4,18 +4,9 @@ import { $ } from "bun"
import pkg from "../package.json"
const dry = process.argv.includes("--dry")
const snapshot = process.argv.includes("--snapshot")
const version = snapshot
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
: await $`git describe --tags --abbrev=0`
.text()
.then((x) => x.substring(1).trim())
.catch(() => {
console.error("tag not found")
process.exit(1)
})
const dry = process.env["OPENCODE_DRY"] === "true"
const version = process.env["OPENCODE_VERSION"]!
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
console.log(`publishing ${version}`)

View file

@ -5,7 +5,7 @@
"exports": {
".": "./dist/index.js"
},
"version": "0.0.0-202507310417",
"version": "0.0.0",
"files": [
"dist"
],

View file

@ -36,3 +36,6 @@ await createClient({
},
],
})
await $`rm -rf dist`
await $`bun tsc`

View file

@ -9,13 +9,16 @@ const version = process.env["OPENCODE_VERSION"]
if (!version) {
throw new Error("OPENCODE_VERSION is required")
}
const dry = process.env["DRY"] === "true"
await import("./generate")
await $`rm -rf dist`
await $`bun tsc`
if (!dry) {
await $`bun pm version --allow-same-version --no-git-tag-version ${version}`
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`
await $`git checkout package.json`
}
if (!snapshot) {
await $`bun publish`
}

View file

@ -13,7 +13,10 @@ process.env["OPENCODE_VERSION"] = version
await import(`../packages/sdk/stainless/generate.ts`)
await import(`../packages/sdk/js/script/publish.ts`)
await import(`../packages/opencode/script/publish.ts`)
await $`git commit -am "Release v${version}"`
await $`git tag v${version}`
await $`git push HEAD --tags`
if (!snapshot) {
await $`git commit -am "Release v${version}"`
await $`git tag v${version}`
await $`git push origin HEAD --tags`
}

View file

@ -1,35 +0,0 @@
#!/bin/bash
set -e
# Parse command line arguments
DEV_MODE=false
for arg in "$@"; do
if [ "$arg" = "--dev" ]; then
DEV_MODE=true
fi
done
bun run ./packages/opencode/src/index.ts generate > openapi.json
echo "Running stl builds create..."
stl builds create --branch dev --pull --allow-empty --+target go --+target typescript
echo "Cleaning up..."
rm -rf packages/tui/sdk
mv opencode-go/ packages/tui/sdk/
rm -rf packages/tui/sdk/.git
rm -rf packages/sdk
mv opencode-typescript/ packages/sdk/
rm -rf packages/sdk/.git
# Only run production build if not in dev mode
if [ "$DEV_MODE" = false ]; then
echo "Kicking off production build..."
stl builds create --branch main --wait=false
else
echo "Skipping production build (--dev flag detected)"
fi
echo "Done!"