diff --git a/.github/workflows/nix-hashes.yml b/.github/workflows/nix-hashes.yml index fce6a7d3e43..63a58ec22cb 100644 --- a/.github/workflows/nix-hashes.yml +++ b/.github/workflows/nix-hashes.yml @@ -6,7 +6,7 @@ permissions: on: workflow_dispatch: push: - branches: [dev, beta] + branches: [dev] paths: - "bun.lock" - "package.json" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8458201edf8..4ac390e4af7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -141,7 +141,8 @@ jobs: sign-cli-macos: needs: build-cli runs-on: macos-26 - if: github.repository == 'anomalyco/opencode' + # Beta publishes only the desktop app, which signs the CLI it bundles. + if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta' steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 @@ -196,7 +197,7 @@ jobs: needs: version runs-on: blacksmith-4vcpu-ubuntu-2404 timeout-minutes: 30 - if: github.repository == 'anomalyco/opencode' && !(github.ref_name == 'dev' && (inputs.bump || inputs.version)) + if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta' && !(github.ref_name == 'dev' && (inputs.bump || inputs.version)) steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 @@ -218,7 +219,7 @@ jobs: needs: - version - build-node-app-archive - if: github.repository == 'anomalyco/opencode' && !(github.ref_name == 'dev' && (inputs.bump || inputs.version)) + if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta' && !(github.ref_name == 'dev' && (inputs.bump || inputs.version)) strategy: fail-fast: false matrix: @@ -276,7 +277,7 @@ jobs: needs: - sign-cli-macos runs-on: blacksmith-4vcpu-windows-2025 - if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'beta') + if: github.repository == 'anomalyco/opencode' && github.ref_name == 'dev' env: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} @@ -591,6 +592,7 @@ jobs: path: packages/opencode/dist - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + if: github.ref_name != 'beta' with: name: opencode-preview-cli path: packages/cli/dist diff --git a/packages/app/README.md b/packages/app/README.md index ff6ca832d9d..fb19e33408c 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -71,17 +71,16 @@ Environment options: ## Deployment -The `deploy` GitHub Actions workflow uses SST to deploy the web app from these branches in `anomalyco/opencode`: +The `deploy` GitHub Actions workflow uses SST to deploy the web app to `beta.opencode.ai` on every push to the +`beta` branch in `anomalyco/opencode`. The `dev` and `production` stages do not deploy the web app. -| Branch | Site | -| ------------ | --------------------- | -| `dev` | `app.dev.opencode.ai` | -| `production` | `app.opencode.ai` | -| `beta` | `beta.opencode.ai` | +`beta` is the team's dogfooding branch: `dev` merged in by hand, plus commits pushed directly to it. Do not rebase or +force-push it. Each push also runs the `publish` workflow, which ships the same commit as the OpenCode Beta desktop app +(see `packages/desktop/README.md`). -Changes merged into `v2` reach the beta site when they are promoted to `beta`. The beta SST stage deploys -only the web app, using the same `WebApp` StaticSite definition as production. It sets the build channel -and Sentry environment to `beta` without deploying the API, console, database, or billing infrastructure. +The beta SST stage deploys only the web app, using the `WebApp` StaticSite definition in `infra/webapp.ts`. It sets +the build channel and Sentry environment to `beta` without deploying the API, console, database, or billing +infrastructure. `VITE_OPENCODE_SERVER_MODE` controls which server the web build provides at startup: diff --git a/packages/desktop/README.md b/packages/desktop/README.md index 0d49419d095..fcdf6406017 100644 --- a/packages/desktop/README.md +++ b/packages/desktop/README.md @@ -40,6 +40,13 @@ CLI preparation uses these channel rules: default. `bun dev --download-server ` instead downloads that CLI version for local development. Neither path requires `OPENCODE_CLI_DIST` or runs the production prebuild. +## Beta channel + +Every push to the `beta` branch publishes OpenCode Beta (`ai.opencode.desktop.beta`) as version `0.0.0-beta-` to +the `beta` update channel. Beta publishes only the desktop app and `beta.opencode.ai`; the CLI and SDK packages ship +from `dev`. Install it from `https://opencode.ai/download/beta/`, for example `darwin-aarch64-dmg` or +`windows-x64-nsis`. Installed builds update in place on every platform. + ## Startup benchmark `bun run bench:startup` measures a **packaged** build from process spawn to the restored tab being ready and the diff --git a/packages/gui-extensions/src/updater/main.ts b/packages/gui-extensions/src/updater/main.ts index 355dc5e560b..1f3e05be30b 100644 --- a/packages/gui-extensions/src/updater/main.ts +++ b/packages/gui-extensions/src/updater/main.ts @@ -105,7 +105,7 @@ const setup: MainSetup = async (ctx) => { after: "about", enabled: () => enabled, run(window) { - // Beta builds check in the focused window, which can offer the stable installer. + // Beta builds check in the focused window, which reports the result in-app. if (build.channel !== "beta") return void runFork(show) if (window) provider.emit("check", null, window.id) diff --git a/packages/gui-extensions/src/updater/migration.test.ts b/packages/gui-extensions/src/updater/migration.test.ts deleted file mode 100644 index c02291d44fc..00000000000 --- a/packages/gui-extensions/src/updater/migration.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect, test } from "bun:test" -import { stableMacDownload } from "./migration" - -test("selects the signed stable installer for the current Mac architecture", () => { - const artifact = { - version: "2.0.2", - metadata: { - files: { - "opencode-desktop-mac-arm64.dmg": { url: "https://files.test/OpenCode-arm64.dmg" }, - "opencode-desktop-mac-x64.dmg": { url: "https://files.test/OpenCode-x64.dmg" }, - }, - }, - } - - expect(stableMacDownload(artifact, "arm64")).toEqual({ - version: "2.0.2", - url: "https://files.test/OpenCode-arm64.dmg", - }) - expect(stableMacDownload(artifact, "x64")).toEqual({ - version: "2.0.2", - url: "https://files.test/OpenCode-x64.dmg", - }) - expect(stableMacDownload(artifact, "ia32")).toBeUndefined() - expect(stableMacDownload({ version: "2.0.2", metadata: { files: {} } }, "arm64")).toBeUndefined() -}) diff --git a/packages/gui-extensions/src/updater/migration.ts b/packages/gui-extensions/src/updater/migration.ts deleted file mode 100644 index cbcba082148..00000000000 --- a/packages/gui-extensions/src/updater/migration.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Option, Schema } from "effect" - -const Artifact = Schema.Struct({ - version: Schema.String, - metadata: Schema.Struct({ - files: Schema.Record(Schema.String, Schema.Struct({ url: Schema.String })), - }), -}) - -const decode = Schema.decodeUnknownOption(Artifact) - -export function requiresStableMacInstaller(platform: string, channel: string) { - return platform === "darwin" && channel === "beta" -} - -export function stableMacDownload(input: unknown, arch: string) { - if (arch !== "arm64" && arch !== "x64") return undefined - const artifact = Option.getOrUndefined(decode(input)) - const file = artifact?.metadata.files[`opencode-desktop-mac-${arch}.dmg`] - - return file && { version: artifact.version, url: file.url } -} diff --git a/packages/gui-extensions/src/updater/platform.ts b/packages/gui-extensions/src/updater/platform.ts index 2dcaa1d0f7c..047c13eb0db 100644 --- a/packages/gui-extensions/src/updater/platform.ts +++ b/packages/gui-extensions/src/updater/platform.ts @@ -1,17 +1,13 @@ -import { app, autoUpdater, shell } from "electron" +import { app, autoUpdater } from "electron" import pkg from "electron-updater" import { Effect } from "effect" import type { Platform } from "./machine" -import { requiresStableMacInstaller, stableMacDownload } from "./migration" const updateClient = pkg.autoUpdater const restartTimeout = 10_000 -const stableArtifact = "https://opencode.ai/update/api/latest/desktop/opencode" - export const make = Effect.fn("Updater.platform")(function* (channel: string) { - const external = requiresStableMacInstaller(process.platform, channel) const userAgent = `opencode/${channel === "prod" ? "latest" : channel}/${app.getVersion()}/desktop` const runFork = Effect.runForkWith(yield* Effect.context()) updateClient.logger = { @@ -36,17 +32,6 @@ export const make = Effect.fn("Updater.platform")(function* (channel: string) { return { checkForUpdate: Effect.tryPromise({ try: async () => { - if (external) { - const response = await fetch(stableArtifact, { headers: { "User-Agent": userAgent } }) - - if (!response.ok) throw new Error(`Stable OpenCode update check failed: ${response.status}`) - const download = stableMacDownload(await response.json(), process.arch) - - if (!download) throw new Error("Stable OpenCode download is unavailable") - - return { mode: "external", ...download } as const - } - const result = await updateClient.checkForUpdates() if (!result?.isUpdateAvailable) return undefined @@ -69,7 +54,6 @@ export const make = Effect.fn("Updater.platform")(function* (channel: string) { }), stageUpdate, installAndRestart, - externalInstall: external ? openExternal : undefined, } satisfies Platform }) @@ -147,13 +131,3 @@ const installAndRestart = Effect.callback((resume) => { ), }), ) - -// Only web links leave the app; a failure to open one is not an install error. -function openExternal(url: string) { - if (!URL.canParse(url) || !["http:", "https:"].includes(new URL(url).protocol)) - return Effect.logWarning("blocked external target", { url }) - - return Effect.tryPromise(() => shell.openExternal(url)).pipe( - Effect.catch((error) => Effect.logError("failed to open external target", { url, error })), - ) -} diff --git a/script/publish.ts b/script/publish.ts index f3c10dcf820..9076807ff43 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -10,6 +10,13 @@ const dir = fileURLToPath(new URL("..", import.meta.url)) process.chdir(dir) const tag = `v${Script.version}` +// Beta dogfoods the desktop app. The CLI and SDK packages ship from dev. +if (Script.channel === "beta") { + console.log("\n=== desktop ===\n") + await $`bun ./packages/desktop/scripts/publish.ts` + process.exit(0) +} + const pkgjsons = await Array.fromAsync( new Bun.Glob("**/package.json").scan({ absolute: true,