From 654f411a5b3bc7468b2bc1c9938d7c8b63d68512 Mon Sep 17 00:00:00 2001 From: Dax Date: Fri, 11 Sep 2026 15:50:35 -0400 Subject: [PATCH] feat(release): isolate v2 stable publishing (#48546) --- .github/workflows/publish.yml | 6 +- bun.lock | 70 ++++++++++----------- package.json | 2 +- packages/ai/package.json | 2 +- packages/app/package.json | 2 +- packages/cli/Dockerfile | 16 +++++ packages/cli/package.json | 2 +- packages/cli/script/publish.ts | 4 ++ packages/client/package.json | 2 +- packages/codemode/package.json | 2 +- packages/console/app/package.json | 2 +- packages/console/core/package.json | 2 +- packages/console/function/package.json | 2 +- packages/console/mail/package.json | 2 +- packages/console/support/package.json | 2 +- packages/core/package.json | 2 +- packages/desktop/package.json | 2 +- packages/desktop/scripts/publish.ts | 86 ++++++++++++++------------ packages/enterprise/package.json | 2 +- packages/function/package.json | 2 +- packages/http-recorder/package.json | 2 +- packages/httpapi-codegen/package.json | 2 +- packages/latex/package.json | 2 +- packages/merman/package.json | 2 +- packages/plugin-browser/package.json | 2 +- packages/plugin/package.json | 2 +- packages/protocol/package.json | 2 +- packages/schema/package.json | 2 +- packages/script/src/index.ts | 1 + packages/sdk/package.json | 2 +- packages/server/package.json | 2 +- packages/session-ui/package.json | 2 +- packages/simulation/package.json | 2 +- packages/stats/app/package.json | 2 +- packages/stats/core/package.json | 2 +- packages/stats/server/package.json | 2 +- packages/theme/package.json | 2 +- packages/tui/package.json | 2 +- packages/ui/package.json | 2 +- packages/util/package.json | 2 +- packages/web/package.json | 2 +- script/publish.ts | 12 ++-- script/release | 16 ++++- script/version.ts | 24 +------ sdks/vscode/package.json | 2 +- services/update/package.json | 2 +- services/update/src/index.ts | 2 +- 47 files changed, 171 insertions(+), 140 deletions(-) create mode 100644 packages/cli/Dockerfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8ca6144a18a..e0b6aa9c13e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,7 @@ on: required: false type: string -concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || inputs.bump }} +concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref_name == 'v2' && (inputs.version || inputs.bump) && 'release') || inputs.version || inputs.bump }} permissions: id-token: write @@ -33,7 +33,7 @@ permissions: packages: write env: - OPENCODE_CHANNEL: ${{ (github.ref_name == 'v2' && 'dev') || '' }} + OPENCODE_CHANNEL: ${{ (github.ref_name == 'v2' && !inputs.bump && !inputs.version && 'dev') || '' }} jobs: version: @@ -378,7 +378,7 @@ jobs: needs: - version - sign-cli-macos - if: github.repository == 'anomalyco/opencode' && github.ref_name != 'v2' + if: github.repository == 'anomalyco/opencode' && (github.ref_name != 'v2' || needs.version.outputs.release != '') continue-on-error: false env: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} diff --git a/bun.lock b/bun.lock index 38a4ca2cac7..30b8f7f4d5e 100644 --- a/bun.lock +++ b/bun.lock @@ -31,7 +31,7 @@ }, "packages/ai": { "name": "@opencode/ai", - "version": "1.17.20", + "version": "2.0.0", "dependencies": { "@aws-sdk/credential-providers": "3.1057.0", "@opencode/schema": "workspace:*", @@ -53,7 +53,7 @@ }, "packages/app": { "name": "@opencode/app", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@corvu/drawer": "catalog:", "@dnd-kit/abstract": "0.5.0", @@ -111,7 +111,7 @@ }, "packages/cli": { "name": "@opencode/cli", - "version": "1.18.4", + "version": "2.0.0", "bin": { "opencode2": "./bin/opencode2.cjs", }, @@ -175,7 +175,7 @@ }, "packages/client": { "name": "@opencode/client", - "version": "1.17.13", + "version": "2.0.0", "dependencies": { "@opencode/protocol": "workspace:*", "@opencode/schema": "workspace:*", @@ -201,7 +201,7 @@ }, "packages/codemode": { "name": "@opencode/codemode", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "acorn": "8.15.0", "effect": "catalog:", @@ -215,7 +215,7 @@ }, "packages/console/app": { "name": "@opencode/console-app", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@cloudflare/vite-plugin": "1.15.2", "@ibm/plex": "6.4.1", @@ -251,7 +251,7 @@ }, "packages/console/core": { "name": "@opencode/console-core", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@aws-sdk/client-sts": "3.782.0", "@jsx-email/render": "1.1.1", @@ -278,7 +278,7 @@ }, "packages/console/function": { "name": "@opencode/console-function", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@openauthjs/openauth": "0.0.0-20250322224806", "@opencode/console-core": "workspace:*", @@ -295,7 +295,7 @@ }, "packages/console/mail": { "name": "@opencode/console-mail", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@jsx-email/all": "2.2.3", "@jsx-email/cli": "1.4.3", @@ -319,7 +319,7 @@ }, "packages/console/support": { "name": "@opencode/console-support", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@cloudflare/vite-plugin": "1.15.2", "@opencode/console-core": "workspace:*", @@ -339,7 +339,7 @@ }, "packages/core": { "name": "@opencode/core", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "@ai-sdk/alibaba": "1.0.17", "@ai-sdk/anthropic": "3.0.82", @@ -411,7 +411,7 @@ }, "packages/desktop": { "name": "@opencode/desktop", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@zip.js/zip.js": "2.7.62", "electron-context-menu": "4.1.2", @@ -463,7 +463,7 @@ }, "packages/enterprise": { "name": "@opencode/enterprise", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@hono/standard-validator": "catalog:", "@opencode-ai/sdk": "1.18.21", @@ -500,7 +500,7 @@ }, "packages/function": { "name": "@opencode/function", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@octokit/auth-app": "8.0.1", "@octokit/rest": "catalog:", @@ -516,7 +516,7 @@ }, "packages/http-recorder": { "name": "@opencode/http-recorder", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@effect/platform-node-shared": "4.0.0-rc.112", }, @@ -535,7 +535,7 @@ }, "packages/httpapi-codegen": { "name": "@opencode/httpapi-codegen", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "effect": "catalog:", "prettier": "3.6.2", @@ -548,7 +548,7 @@ }, "packages/latex": { "name": "@opencode/latex", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "@opencode/plugin": "workspace:*", "@opentui/core": "catalog:", @@ -562,7 +562,7 @@ }, "packages/merman": { "name": "@opencode/merman", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "@opencode/plugin": "workspace:*", "@opentui/core": "catalog:", @@ -577,7 +577,7 @@ }, "packages/plugin": { "name": "@opencode/plugin", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@ai-sdk/provider": "3.0.8", "@opencode/ai": "workspace:*", @@ -616,7 +616,7 @@ }, "packages/plugin-browser": { "name": "@opencode/plugin-browser", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "@opencode/plugin": "workspace:*", "@opencode/schema": "workspace:*", @@ -646,7 +646,7 @@ }, "packages/protocol": { "name": "@opencode/protocol", - "version": "1.17.11", + "version": "2.0.0", "dependencies": { "@opencode/schema": "workspace:*", "effect": "catalog:", @@ -661,7 +661,7 @@ }, "packages/schema": { "name": "@opencode/schema", - "version": "1.17.11", + "version": "2.0.0", "dependencies": { "@standard-schema/spec": "catalog:", "effect": "catalog:", @@ -685,7 +685,7 @@ }, "packages/sdk": { "name": "@opencode/sdk", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "@opencode/client": "workspace:*", "@opencode/core": "workspace:*", @@ -706,7 +706,7 @@ }, "packages/server": { "name": "@opencode/server", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "@effect/platform-node": "catalog:", "@effect/platform-node-shared": "catalog:", @@ -728,7 +728,7 @@ }, "packages/session-ui": { "name": "@opencode/session-ui", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@kobalte/core": "catalog:", "@opencode/client": "workspace:*", @@ -763,7 +763,7 @@ }, "packages/simulation": { "name": "@opencode/simulation", - "version": "1.17.13", + "version": "2.0.0", "dependencies": { "@opencode/ai": "workspace:*", "@opencode/core": "workspace:*", @@ -783,7 +783,7 @@ }, "packages/stats/app": { "name": "@opencode/stats-app", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@ibm/plex": "6.4.1", "@kobalte/core": "catalog:", @@ -817,7 +817,7 @@ }, "packages/stats/core": { "name": "@opencode/stats-core", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@aws-sdk/client-athena": "3.933.0", "@planetscale/database": "1.19.0", @@ -836,7 +836,7 @@ }, "packages/stats/server": { "name": "@opencode/stats-server", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@aws-sdk/client-firehose": "3.933.0", "@effect/platform-node": "catalog:", @@ -882,7 +882,7 @@ }, "packages/theme": { "name": "@opencode/theme", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "@opentui/core": "catalog:", "effect": "catalog:", @@ -896,7 +896,7 @@ }, "packages/tui": { "name": "@opencode/tui", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "@opencode/client": "workspace:*", "@opencode/core": "workspace:*", @@ -931,7 +931,7 @@ }, "packages/ui": { "name": "@opencode/ui", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@kobalte/core": "catalog:", "@pierre/diffs": "catalog:", @@ -966,7 +966,7 @@ }, "packages/util": { "name": "@opencode/util", - "version": "1.18.3", + "version": "2.0.0", "dependencies": { "@effect/opentelemetry": "catalog:", "@effect/platform-node": "catalog:", @@ -999,7 +999,7 @@ }, "packages/web": { "name": "@opencode/web", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@astrojs/cloudflare": "12.6.3", "@astrojs/markdown-remark": "6.3.1", @@ -1040,7 +1040,7 @@ }, "services/update": { "name": "@opencode/update", - "version": "1.18.4", + "version": "2.0.0", "dependencies": { "jose": "6.0.11", "semver": "catalog:", diff --git a/package.json b/package.json index deccb967bbb..964e5f4b369 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/package.json", "name": "opencode", "description": "AI-powered development tool", - "version": "0.0.0", + "version": "2.0.0", "private": true, "type": "module", "packageManager": "bun@1.4.2", diff --git a/packages/ai/package.json b/packages/ai/package.json index 7ec30a66539..73778f51ba9 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "1.17.20", + "version": "2.0.0", "name": "@opencode/ai", "type": "module", "license": "MIT", diff --git a/packages/app/package.json b/packages/app/package.json index f4a96037448..69b3ca14e18 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/app", - "version": "1.18.15", + "version": "2.0.0", "description": "", "type": "module", "exports": { diff --git a/packages/cli/Dockerfile b/packages/cli/Dockerfile new file mode 100644 index 00000000000..48cb03f39e3 --- /dev/null +++ b/packages/cli/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine AS base + +ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 +ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH} +RUN apk add --no-cache libgcc libstdc++ ripgrep + +FROM base AS build-amd64 +COPY dist/opencode-linux-x64-baseline-musl/bin/opencode /usr/local/bin/opencode + +FROM base AS build-arm64 +COPY dist/opencode-linux-arm64-musl/bin/opencode /usr/local/bin/opencode + +ARG TARGETARCH +FROM build-${TARGETARCH} +RUN opencode --version +ENTRYPOINT ["opencode"] diff --git a/packages/cli/package.json b/packages/cli/package.json index 2e8b525407c..327e1ce157f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/cli", - "version": "1.18.4", + "version": "2.0.0", "type": "module", "license": "MIT", "bin": { diff --git a/packages/cli/script/publish.ts b/packages/cli/script/publish.ts index b5114861bce..71e539ac454 100755 --- a/packages/cli/script/publish.ts +++ b/packages/cli/script/publish.ts @@ -147,6 +147,10 @@ if (existsSync(path.join(root, "node"))) { }) } +if (Script.channel === "latest" && Script.release && !dryRun) { + await $`docker buildx build --platform linux/amd64,linux/arm64 --tag ghcr.io/anomalyco/opencode:${Script.version} --push .` +} + if (Script.channel === "beta" && Script.release) { await $`bun ./script/publish-aur.ts ${dryRun ? ["--dry-run"] : []}`.env({ ...process.env, OPENCODE_CLI_DIST: root }) } diff --git a/packages/client/package.json b/packages/client/package.json index 2636b5dd6be..10510526b32 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/client", - "version": "1.17.13", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/codemode/package.json b/packages/codemode/package.json index cda2631ca70..1dab8de507d 100644 --- a/packages/codemode/package.json +++ b/packages/codemode/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/codemode", - "version": "1.18.4", + "version": "2.0.0", "description": "Effect-native confined code execution over schema-described tools", "type": "module", "license": "MIT", diff --git a/packages/console/app/package.json b/packages/console/app/package.json index d178a188783..ffab527dc22 100644 --- a/packages/console/app/package.json +++ b/packages/console/app/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-app", - "version": "1.18.15", + "version": "2.0.0", "type": "module", "license": "MIT", "scripts": { diff --git a/packages/console/core/package.json b/packages/console/core/package.json index 243f890926d..c812b4eff44 100644 --- a/packages/console/core/package.json +++ b/packages/console/core/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/console-core", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/console/function/package.json b/packages/console/function/package.json index 644d1b66585..f88747e6c1b 100644 --- a/packages/console/function/package.json +++ b/packages/console/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-function", - "version": "1.18.15", + "version": "2.0.0", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/console/mail/package.json b/packages/console/mail/package.json index 327298d49c1..fa1e065ded1 100644 --- a/packages/console/mail/package.json +++ b/packages/console/mail/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-mail", - "version": "1.18.15", + "version": "2.0.0", "dependencies": { "@jsx-email/all": "2.2.3", "@jsx-email/cli": "1.4.3", diff --git a/packages/console/support/package.json b/packages/console/support/package.json index 0baa5d7f8a8..8911f957ecc 100644 --- a/packages/console/support/package.json +++ b/packages/console/support/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-support", - "version": "1.18.15", + "version": "2.0.0", "type": "module", "license": "MIT", "scripts": { diff --git a/packages/core/package.json b/packages/core/package.json index 14a92dd349e..278aaa132e5 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "1.18.4", + "version": "2.0.0", "name": "@opencode/core", "type": "module", "license": "MIT", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 317278d5bd7..525470a6d3c 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/desktop", "private": true, - "version": "1.18.15", + "version": "2.0.0", "type": "module", "license": "MIT", "homepage": "https://opencode.ai", diff --git a/packages/desktop/scripts/publish.ts b/packages/desktop/scripts/publish.ts index 23cc10ae477..45aa120b930 100644 --- a/packages/desktop/scripts/publish.ts +++ b/packages/desktop/scripts/publish.ts @@ -1,8 +1,6 @@ #!/usr/bin/env bun import { Script } from "@opencode/script" -import { $ } from "bun" -import path from "node:path" import { UpdateArtifact } from "../../../script/update-artifact" const dryRun = process.argv.includes("--dry-run") @@ -10,11 +8,8 @@ if (!Script.release) { console.log("skipped desktop publication without a release") process.exit(0) } -const repo = process.env.GH_REPO -if (!repo) throw new Error("GH_REPO is required") const directory = process.env.OPENCODE_DESKTOP_DIST if (!directory) throw new Error("OPENCODE_DESKTOP_DIST is required") -const tag = `v${Script.version}` const files = ( await Array.fromAsync( new Bun.Glob("*.{exe,blockmap,dmg,zip,AppImage,deb,rpm,app.tar.gz}").scan({ cwd: directory, absolute: true }), @@ -22,24 +17,16 @@ const files = ( ).sort() if (!files.length) throw new Error("No desktop release files found") -if (!dryRun) { - await $`gh release upload ${tag} ${files} --clobber --repo ${repo}` - await $`bun ${path.join(import.meta.dir, "finalize-latest-json.ts")}` - await $`bun ${path.join(import.meta.dir, "finalize-latest-yml.ts")}` -} - const uploaded = await UpdateArtifact.upload({ version: Script.version, files, dryRun }) -const artifacts = [ - { distribution: "github", metadata: await metadata(Script.version, repo) }, - { distribution: "opencode", metadata: { files: uploaded, ...(await metadata(Script.version, repo, uploaded)) } }, -] - -if (!dryRun) await $`gh release edit ${tag} --draft=false --repo ${repo}` -for (const artifact of artifacts) { - const input = { ...artifact, channel: Script.channel, name: "desktop", version: Script.version } - if (dryRun) console.log(`dry-run artifact: ${JSON.stringify(input)}`) - if (!dryRun) await UpdateArtifact.publish(input) +const artifact = { + channel: Script.channel, + name: "desktop", + distribution: "opencode", + version: Script.version, + metadata: { files: uploaded, ...(await metadata(Script.version, uploaded)) }, } +if (dryRun) console.log(`dry-run artifact: ${JSON.stringify(artifact)}`) +if (!dryRun) await UpdateArtifact.publish(artifact) type DesktopFile = { url: string @@ -48,26 +35,53 @@ type DesktopFile = { blockMapSize?: number } -async function metadata(version: string, repo: string, files?: Record) { - const directory = process.env.RUNNER_TEMP ?? "/tmp" +async function metadata(version: string, files: Record) { + const directory = process.env.LATEST_YML_DIR + if (!directory) throw new Error("LATEST_YML_DIR is required") const entries = await Promise.all( [ - ["desktop.yml", "latest.yml"], - ["desktop-mac.yml", "latest-mac.yml"], - ["desktop-linux.yml", "latest-linux.yml"], - ["desktop-linux-arm64.yml", "latest-linux-arm64.yml"], - ].map(async ([name, source]) => { - const file = Bun.file(`${directory}/${source}`) - if (!(await file.exists())) return undefined - return [name, parse(await file.text(), version, repo, files)] as const + { + name: "desktop.yml", + sources: [ + ["latest-yml-aarch64-pc-windows-msvc", "latest.yml"], + ["latest-yml-x86_64-pc-windows-msvc", "latest.yml"], + ], + }, + { + name: "desktop-mac.yml", + sources: [ + ["latest-yml-aarch64-apple-darwin", "latest-mac.yml"], + ["latest-yml-x86_64-apple-darwin", "latest-mac.yml"], + ], + }, + { name: "desktop-linux.yml", sources: [["latest-yml-x86_64-unknown-linux-gnu", "latest-linux.yml"]] }, + { + name: "desktop-linux-arm64.yml", + sources: [["latest-yml-aarch64-unknown-linux-gnu", "latest-linux-arm64.yml"]], + }, + ].map(async (item) => { + const manifests = ( + await Promise.all( + item.sources.map(async ([subdirectory, source]) => { + const file = Bun.file(`${directory}/${subdirectory}/${source}`) + if (!(await file.exists())) return undefined + return parse(await file.text(), version, files) + }), + ) + ).filter((manifest) => manifest !== undefined) + if (manifests.length !== item.sources.length) return undefined + return [ + item.name, + { files: manifests.flatMap((manifest) => manifest.files), releaseDate: manifests[0]!.releaseDate }, + ] as const }), ) + if (entries.some((entry) => entry === undefined)) throw new Error("Desktop update metadata is incomplete") const manifests = Object.fromEntries(entries.filter((entry) => entry !== undefined)) - if (!Object.keys(manifests).length) throw new Error("No desktop update metadata found") return { manifests } } -function parse(content: string, version: string, repo: string, uploaded?: Record) { +function parse(content: string, version: string, uploaded: Record) { const lines = content.split("\n") const found = lines .find((line) => line.startsWith("version:")) @@ -86,11 +100,7 @@ function parse(content: string, version: string, repo: string, uploaded?: Record if (value.startsWith("- url:")) { const name = value.slice("- url:".length).trim() const filename = name.startsWith("http") ? decodeURIComponent(new URL(name).pathname.split("/").pop()!) : name - const url = uploaded - ? uploaded[filename]?.url - : name.startsWith("http") - ? name - : `https://github.com/${repo}/releases/download/v${version}/${encodeURIComponent(name)}` + const url = uploaded[filename]?.url if (!url) throw new Error(`Desktop update file was not uploaded: ${filename}`) files.push({ url, sha512: "", size: 0 }) return diff --git a/packages/enterprise/package.json b/packages/enterprise/package.json index 12d5d6f6625..8de913b3099 100644 --- a/packages/enterprise/package.json +++ b/packages/enterprise/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/enterprise", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/function/package.json b/packages/function/package.json index 687c379d417..4471785b57a 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "1.18.15", + "version": "2.0.0", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/http-recorder/package.json b/packages/http-recorder/package.json index 080665caa59..9743db2743c 100644 --- a/packages/http-recorder/package.json +++ b/packages/http-recorder/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "1.18.15", + "version": "2.0.0", "name": "@opencode/http-recorder", "description": "Record and replay Effect HTTP and WebSocket traffic with deterministic cassettes", "type": "module", diff --git a/packages/httpapi-codegen/package.json b/packages/httpapi-codegen/package.json index aa3bfc7c080..93b79c6f0f7 100644 --- a/packages/httpapi-codegen/package.json +++ b/packages/httpapi-codegen/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/httpapi-codegen", - "version": "0.0.0", + "version": "2.0.0", "private": true, "type": "module", "exports": { diff --git a/packages/latex/package.json b/packages/latex/package.json index c03db470846..ede24e61571 100644 --- a/packages/latex/package.json +++ b/packages/latex/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/latex", - "version": "0.0.0", + "version": "2.0.0", "private": true, "type": "module", "exports": { diff --git a/packages/merman/package.json b/packages/merman/package.json index 32779908950..e8a09209001 100644 --- a/packages/merman/package.json +++ b/packages/merman/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/merman", - "version": "0.0.0", + "version": "2.0.0", "private": true, "type": "module", "exports": { diff --git a/packages/plugin-browser/package.json b/packages/plugin-browser/package.json index ec449d63999..d801e087564 100644 --- a/packages/plugin-browser/package.json +++ b/packages/plugin-browser/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/plugin-browser", - "version": "0.0.0", + "version": "2.0.0", "description": "OpenCode's desktop browser plugin", "type": "module", "license": "MIT", diff --git a/packages/plugin/package.json b/packages/plugin/package.json index f80ad6e81ec..5de2efd84bb 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/plugin", - "version": "1.18.15", + "version": "2.0.0", "type": "module", "license": "MIT", "scripts": { diff --git a/packages/protocol/package.json b/packages/protocol/package.json index faa62805beb..33aae644c82 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/protocol", - "version": "1.17.11", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/schema/package.json b/packages/schema/package.json index 1b062721e5d..5816768004a 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/schema", - "version": "1.17.11", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts index 5d6508758dc..cdcad380dab 100644 --- a/packages/script/src/index.ts +++ b/packages/script/src/index.ts @@ -40,6 +40,7 @@ const VERSION = await (async () => { return res.json() }) .then((data: any) => data.version) + if (semver.lt(version, "2.0.0")) return "2.0.0" const [major, minor, patch] = version.split(".").map((x: string) => Number(x) || 0) const t = env.OPENCODE_BUMP?.toLowerCase() if (t === "major") return `${major + 1}.0.0` diff --git a/packages/sdk/package.json b/packages/sdk/package.json index b9d26191cd2..9dd855e195a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "1.18.4", + "version": "2.0.0", "name": "@opencode/sdk", "type": "module", "license": "MIT", diff --git a/packages/server/package.json b/packages/server/package.json index 27c81908f9a..862d953ac7f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/server", - "version": "1.18.4", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/session-ui/package.json b/packages/session-ui/package.json index d2970d81a62..5d50aeec187 100644 --- a/packages/session-ui/package.json +++ b/packages/session-ui/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/session-ui", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/simulation/package.json b/packages/simulation/package.json index dc842713760..d772f83425e 100644 --- a/packages/simulation/package.json +++ b/packages/simulation/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/simulation", - "version": "1.17.13", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/stats/app/package.json b/packages/stats/app/package.json index b1b74af73c9..01b6e4079b4 100644 --- a/packages/stats/app/package.json +++ b/packages/stats/app/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/stats-app", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/stats/core/package.json b/packages/stats/core/package.json index 0ba85b6b5dc..9024db73b0d 100644 --- a/packages/stats/core/package.json +++ b/packages/stats/core/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/stats-core", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/stats/server/package.json b/packages/stats/server/package.json index 55c2c9d94da..59a29e795de 100644 --- a/packages/stats/server/package.json +++ b/packages/stats/server/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/stats-server", - "version": "1.18.15", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/theme/package.json b/packages/theme/package.json index 9b82c7f01b1..527fa16140f 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/theme", - "version": "0.0.0", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/tui/package.json b/packages/tui/package.json index fa3161410a3..96396aeab17 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/tui", - "version": "1.18.4", + "version": "2.0.0", "private": true, "type": "module", "license": "MIT", diff --git a/packages/ui/package.json b/packages/ui/package.json index b1d08b9064d..4e6f002793a 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/ui", - "version": "1.18.15", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/util/package.json b/packages/util/package.json index 08b4da5d194..cf7a126c46f 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/util", - "version": "1.18.3", + "version": "2.0.0", "type": "module", "license": "MIT", "repository": { diff --git a/packages/web/package.json b/packages/web/package.json index b2c5a712c3b..f0b942bfe25 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -2,7 +2,7 @@ "name": "@opencode/web", "type": "module", "license": "MIT", - "version": "1.18.15", + "version": "2.0.0", "scripts": { "dev": "astro dev", "dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev", diff --git a/script/publish.ts b/script/publish.ts index e493537c37f..01106cb40ab 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -34,6 +34,8 @@ if (Script.release && !Script.preview) { await prepareReleaseFiles() +if (Script.release) await $`bun ./packages/desktop/scripts/publish.ts --dry-run` + console.log("\n=== schema ===\n") await $`bun ./packages/schema/script/publish.ts` @@ -80,16 +82,18 @@ console.log("\n=== ui ===\n") await $`bun ./packages/ui/script/publish.ts` if (Script.release && !Script.preview) { - await $`git commit -am "release: ${tag}"` + if ((await $`git diff --quiet`.nothrow()).exitCode !== 0) await $`git commit -am "release: ${tag}"` await $`git tag -d ${tag}`.nothrow() await $`git tag ${tag}` await $`git push origin refs/tags/${tag} --force-with-lease --no-verify` await new Promise((resolve) => setTimeout(resolve, 5_000)) await $`git fetch origin` - await $`git checkout -B dev origin/dev` + await $`git checkout -B v2 origin/v2` await prepareReleaseFiles() - await $`git commit -am "sync release versions for ${tag}"` - await $`git push origin HEAD:dev --no-verify` + if ((await $`git diff --quiet`.nothrow()).exitCode !== 0) { + await $`git commit -am "sync release versions for ${tag}"` + await $`git push origin HEAD:v2 --no-verify` + } } if (Script.release) { diff --git a/script/release b/script/release index 3738d4ee39c..8296b8fd6d5 100755 --- a/script/release +++ b/script/release @@ -1,3 +1,17 @@ #!/usr/bin/env bash -gh workflow run publish.yml --ref v2 +VERSION=${1:-patch} + +case "$VERSION" in + major|minor|patch) + gh workflow run publish.yml --ref v2 -f bump="$VERSION" + ;; + *) + if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$ ]]; then + gh workflow run publish.yml --ref v2 -f version="$VERSION" + exit 0 + fi + echo "usage: $0 [major|minor|patch|version]" >&2 + exit 1 + ;; +esac diff --git a/script/version.ts b/script/version.ts index 1445a5c8596..f9e950d8958 100755 --- a/script/version.ts +++ b/script/version.ts @@ -1,30 +1,12 @@ #!/usr/bin/env bun import { Script } from "@opencode/script" -import { $ } from "bun" const output = [`version=${Script.version}`] -const sha = process.env.GITHUB_SHA ?? (await $`git rev-parse HEAD`.text()).trim() -if (!Script.preview) { - await $`bun script/changelog.ts --to ${sha}`.cwd(process.cwd()) - const file = `${process.cwd()}/UPCOMING_CHANGELOG.md` - const body = await Bun.file(file) - .text() - .catch(() => "No notable changes") - const dir = process.env.RUNNER_TEMP ?? "/tmp" - const notesFile = `${dir}/opencode-release-notes.txt` - await Bun.write(notesFile, body) - await $`gh release create v${Script.version} -d --target ${sha} --title "v${Script.version}" --notes-file ${notesFile}` - const release = await $`gh release view v${Script.version} --json tagName,databaseId`.json() - output.push(`release=${release.databaseId}`) - output.push(`tag=${release.tagName}`) -} else if (Script.channel === "beta") { - await $`gh release create v${Script.version} -d --title "v${Script.version}" --repo ${process.env.GH_REPO}` - const release = - await $`gh release view v${Script.version} --json tagName,databaseId --repo ${process.env.GH_REPO}`.json() - output.push(`release=${release.databaseId}`) - output.push(`tag=${release.tagName}`) +if (!Script.preview || Script.channel === "beta") { + output.push("release=true") + output.push(`tag=v${Script.version}`) } output.push(`repo=${process.env.GH_REPO}`) diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index 8c4964b958d..6a45cb5793b 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "1.18.15", + "version": "2.0.0", "publisher": "sst-dev", "repository": { "type": "git", diff --git a/services/update/package.json b/services/update/package.json index e4602b6a5ae..74cc1b72df8 100644 --- a/services/update/package.json +++ b/services/update/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/update", - "version": "1.18.4", + "version": "2.0.0", "private": true, "type": "module", "scripts": { diff --git a/services/update/src/index.ts b/services/update/src/index.ts index c0a5fda2af4..41447b92c1a 100644 --- a/services/update/src/index.ts +++ b/services/update/src/index.ts @@ -520,7 +520,7 @@ export function validGitHubClaims(claims: JWTPayload): claims is GitHubClaims { export function channelsForRef(ref: string) { if (ref === "refs/heads/dev") return ["dev", "latest"] - if (ref === "refs/heads/v2") return ["dev"] + if (ref === "refs/heads/v2") return ["dev", "latest"] if (ref === "refs/heads/beta") return ["beta"] if (ref === "refs/heads/ci") return ["ci"] if (ref === "refs/heads/fix/npm-native-binary-install") return ["fix/npm-native-binary-install"]