mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-25 03:34:22 +01:00
ci: new publish method (#1451)
This commit is contained in:
26
scripts/publish.ts
Normal file → Executable file
26
scripts/publish.ts
Normal file → Executable file
@@ -2,9 +2,27 @@
|
||||
|
||||
import { $ } from "bun"
|
||||
|
||||
import pkg from "../package.json"
|
||||
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
|
||||
const version = snapshot
|
||||
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
|
||||
: process.env["OPENCODE_VERSION"]
|
||||
if (!version) {
|
||||
throw new Error("OPENCODE_VERSION is required")
|
||||
}
|
||||
process.env["OPENCODE_VERSION"] = version
|
||||
|
||||
const version = process.env["VERSION"]
|
||||
await import(`../packages/opencode/script/publish.ts`)
|
||||
await import(`../packages/sdk/stainless/generate.ts`)
|
||||
await import(`../packages/sdk/js/script/publish.ts`)
|
||||
|
||||
console.log("publishing stainless")
|
||||
await import("./stainless.ts")
|
||||
if (!snapshot) {
|
||||
await $`git commit -am "Release v${version}"`
|
||||
await $`git tag v${version}`
|
||||
await $`git push origin HEAD --tags`
|
||||
}
|
||||
if (snapshot) {
|
||||
await $`git commit --allow-empty -m "Snapshot release v${version}"`
|
||||
await $`git tag v${version}`
|
||||
await $`git push origin v${version}`
|
||||
await $`git reset --soft HEAD~1`
|
||||
}
|
||||
|
||||
@@ -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!"
|
||||
|
||||
Reference in New Issue
Block a user