GeezerVison is showing github.com — desktop: publish betas to separate repo (#14376) · zwying/opencode@ce17f9d
File treeExpand file treeCollapse file tree Open diff view settings console/app/src/routes/download
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/publish.yml +31-4Lines changed: 31 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 41 | 41 |
| 42 | 42 | - uses: ./.github/actions/setup-bun | 43 | 43 |
| | 44 | + - name: Setup git committer | | 45 | + id: committer | | 46 | + uses: ./.github/actions/setup-git-committer | | 47 | + with: | | 48 | + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} | | 49 | + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} | | 50 | + | 44 | 51 | - name: Install OpenCode | 45 | 52 | if: inputs.bump || inputs.version | 46 | 53 | run: bun i -g opencode-ai | @@ -49,14 +56,16 @@ jobs: | 49 | 56 | run: | | 50 | 57 | ./script/version.ts | 51 | 58 | env: | 52 | | - GH_TOKEN: ${{ github.token }} | | 59 | + GH_TOKEN: ${{ steps.committer.outputs.token }} | 53 | 60 | OPENCODE_BUMP: ${{ inputs.bump }} | 54 | 61 | OPENCODE_VERSION: ${{ inputs.version }} | 55 | 62 | OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | | 63 | + GH_REPO: ${{ (github.ref_name == 'beta' && 'anomalyco/opencode-beta') || github.repository }} | 56 | 64 | outputs: | 57 | 65 | version: ${{ steps.version.outputs.version }} | 58 | 66 | release: ${{ steps.version.outputs.release }} | 59 | 67 | tag: ${{ steps.version.outputs.tag }} | | 68 | + repo: ${{ steps.version.outputs.repo }} | 60 | 69 |
| 61 | 70 | build-cli: | 62 | 71 | needs: version | @@ -69,14 +78,22 @@ jobs: | 69 | 78 |
| 70 | 79 | - uses: ./.github/actions/setup-bun | 71 | 80 |
| | 81 | + - name: Setup git committer | | 82 | + id: committer | | 83 | + uses: ./.github/actions/setup-git-committer | | 84 | + with: | | 85 | + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} | | 86 | + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} | | 87 | + | 72 | 88 | - name: Build | 73 | 89 | id: build | 74 | 90 | run: | | 75 | 91 | ./packages/opencode/script/build.ts | 76 | 92 | env: | 77 | 93 | OPENCODE_VERSION: ${{ needs.version.outputs.version }} | 78 | 94 | OPENCODE_RELEASE: ${{ needs.version.outputs.release }} | 79 | | - GH_TOKEN: ${{ github.token }} | | 95 | + GH_REPO: ${{ needs.version.outputs.repo }} | | 96 | + GH_TOKEN: ${{ steps.committer.outputs.token }} | 80 | 97 |
| 81 | 98 | - uses: actions/upload-artifact@v4 | 82 | 99 | with: | @@ -189,21 +206,30 @@ jobs: | 189 | 206 | if: contains(matrix.settings.host, 'ubuntu') | 190 | 207 | run: cargo tauri --version | 191 | 208 |
| | 209 | + - name: Setup git committer | | 210 | + id: committer | | 211 | + uses: ./.github/actions/setup-git-committer | | 212 | + with: | | 213 | + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} | | 214 | + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} | | 215 | + | 192 | 216 | - name: Build and upload artifacts | 193 | 217 | uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a | 194 | 218 | timeout-minutes: 60 | 195 | 219 | with: | 196 | 220 | projectPath: packages/desktop | 197 | 221 | uploadWorkflowArtifacts: true | 198 | 222 | tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }} | 199 | | - args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose | | 223 | + args: --target ${{ matrix.settings.target }} --config ${{ (github.ref_name == 'beta' && './src-tauri/tauri.beta.conf.json') || './src-tauri/tauri.prod.conf.json' }} --verbose | 200 | 224 | updaterJsonPreferNsis: true | 201 | 225 | releaseId: ${{ needs.version.outputs.release }} | 202 | 226 | tagName: ${{ needs.version.outputs.tag }} | 203 | 227 | releaseDraft: true | 204 | 228 | releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext] | | 229 | + repo: ${{ (github.ref_name == 'beta' && 'opencode-beta') || '' }} | | 230 | + releaseCommitish: ${{ github.sha }} | 205 | 231 | env: | 206 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | | 232 | + GITHUB_TOKEN: ${{ steps.committer.outputs.token }} | 207 | 233 | TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true | 208 | 234 | TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | 209 | 235 | TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | @@ -280,4 +306,5 @@ jobs: | 280 | 306 | OPENCODE_RELEASE: ${{ needs.version.outputs.release }} | 281 | 307 | AUR_KEY: ${{ secrets.AUR_KEY }} | 282 | 308 | GITHUB_TOKEN: ${{ steps.committer.outputs.token }} | | 309 | + GH_REPO: ${{ needs.version.outputs.repo }} | 283 | 310 | NPM_CONFIG_PROVENANCE: false |
Collapse file Copy file name to clipboardExpand all lines: packages/console/app/src/routes/download/[channel]/[platform].ts +13-10Lines changed: 13 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -import { APIEvent } from "@solidjs/start" | 2 | | -import { DownloadPlatform } from "./types" | | 1 | +import type { APIEvent } from "@solidjs/start" | | 2 | +import type { DownloadPlatform } from "../types" | 3 | 3 |
| 4 | 4 | const assetNames: Record<string, string> = { | 5 | 5 | "darwin-aarch64-dmg": "opencode-desktop-darwin-aarch64.dmg", | @@ -17,17 +17,20 @@ const downloadNames: Record<string, string> = { | 17 | 17 | "windows-x64-nsis": "OpenCode Desktop Installer.exe", | 18 | 18 | } satisfies { [K in DownloadPlatform]?: string } | 19 | 19 |
| 20 | | -export async function GET({ params: { platform } }: APIEvent) { | | 20 | +export async function GET({ params: { platform, channel } }: APIEvent) { | 21 | 21 | const assetName = assetNames[platform] | 22 | 22 | if (!assetName) return new Response("Not Found", { status: 404 }) | 23 | 23 |
| 24 | | - const resp = await fetch(`https://github.com/anomalyco/opencode/releases/latest/download/${assetName}`, { | 25 | | - cf: { | 26 | | - // in case gh releases has rate limits | 27 | | - cacheTtl: 60 * 5, | 28 | | - cacheEverything: true, | 29 | | - }, | 30 | | - } as any) | | 24 | + const resp = await fetch( | | 25 | + `https://github.com/anomalyco/${channel === "stable" ? "opencode" : "opencode-beta"}/releases/latest/download/${assetName}`, | | 26 | + { | | 27 | + cf: { | | 28 | + // in case gh releases has rate limits | | 29 | + cacheTtl: 60 * 5, | | 30 | + cacheEverything: true, | | 31 | + }, | | 32 | + } as any, | | 33 | + ) | 31 | 34 |
| 32 | 35 | const downloadName = downloadNames[platform] | 33 | 36 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/console/app/src/routes/download/index.tsx +11-11Lines changed: 11 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import "./index.css" | 2 | | -import { Title, Meta } from "@solidjs/meta" | 3 | | -import { A, createAsync, query } from "@solidjs/router" | 4 | | -import { Header } from "~/component/header" | 5 | | -import { Footer } from "~/component/footer" | 6 | | -import { IconCopy, IconCheck } from "~/component/icon" | | 2 | +import { Meta, Title } from "@solidjs/meta" | | 3 | +import { A } from "@solidjs/router" | | 4 | +import { createSignal, type JSX, onMount, Show } from "solid-js" | 7 | 5 | import { Faq } from "~/component/faq" | 8 | | -import desktopAppIcon from "../../asset/lander/opencode-desktop-icon.png" | | 6 | +import { Footer } from "~/component/footer" | | 7 | +import { Header } from "~/component/header" | | 8 | +import { IconCheck, IconCopy } from "~/component/icon" | 9 | 9 | import { Legal } from "~/component/legal" | | 10 | +import { LocaleLinks } from "~/component/locale-links" | 10 | 11 | import { config } from "~/config" | 11 | | -import { createSignal, onMount, Show, JSX } from "solid-js" | 12 | | -import { DownloadPlatform } from "./types" | 13 | 12 | import { useI18n } from "~/context/i18n" | 14 | 13 | import { useLanguage } from "~/context/language" | 15 | | -import { LocaleLinks } from "~/component/locale-links" | | 14 | +import desktopAppIcon from "../../asset/lander/opencode-desktop-icon.png" | | 15 | +import type { DownloadPlatform } from "./types" | 16 | 16 |
| 17 | 17 | type OS = "macOS" | "Windows" | "Linux" | null | 18 | 18 |
| @@ -40,8 +40,8 @@ function getDownloadPlatform(os: OS): DownloadPlatform { | 40 | 40 | } | 41 | 41 | } | 42 | 42 |
| 43 | | -function getDownloadHref(platform: DownloadPlatform) { | 44 | | - return `/download/${platform}` | | 43 | +function getDownloadHref(platform: DownloadPlatform, channel: "stable" | "beta" = "stable") { | | 44 | + return `/download/${channel}/${platform}` | 45 | 45 | } | 46 | 46 |
| 47 | 47 | function IconDownload(props: JSX.SvgSVGAttributes<SVGSVGElement>) { | |
Collapse file Copy file name to clipboard +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "$schema": "https://schema.tauri.app/config/2", | | 3 | + "productName": "OpenCode Beta", | | 4 | + "identifier": "ai.opencode.desktop.beta", | | 5 | + "bundle": { | | 6 | + "createUpdaterArtifacts": true, | | 7 | + "linux": { | | 8 | + "rpm": { | | 9 | + "compression": { | | 10 | + "type": "none" | | 11 | + } | | 12 | + } | | 13 | + } | | 14 | + }, | | 15 | + "plugins": { | | 16 | + "updater": { | | 17 | + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEYwMDM5Nzg5OUMzOUExMDQKUldRRW9UbWNpWmNEOENYT01CV0lhOXR1UFhpaXJsK1Z3aU9lZnNtNzE0TDROWVMwVW9XQnFOelkK", | | 18 | + "endpoints": ["https://github.com/anomalyco/opencode-beta/releases/latest/download/latest.json"] | | 19 | + } | | 20 | + } | | 21 | +} |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/script/build.ts +11-7Lines changed: 11 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #!/usr/bin/env bun | 2 | 2 |
| 3 | | -import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin" | 4 | | -import path from "path" | 5 | | -import fs from "fs" | 6 | 3 | import { $ } from "bun" | | 4 | +import fs from "fs" | | 5 | +import path from "path" | 7 | 6 | import { fileURLToPath } from "url" | | 7 | +import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin" | 8 | 8 |
| 9 | 9 | const __filename = fileURLToPath(import.meta.url) | 10 | 10 | const __dirname = path.dirname(__filename) | 11 | 11 | const dir = path.resolve(__dirname, "..") | 12 | 12 |
| 13 | 13 | process.chdir(dir) | 14 | 14 |
| 15 | | -import pkg from "../package.json" | 16 | 15 | import { Script } from "@opencode-ai/script" | | 16 | +import pkg from "../package.json" | | 17 | + | 17 | 18 | const modelsUrl = process.env.OPENCODE_MODELS_URL || "https://models.dev" | 18 | 19 | // Fetch and generate models.dev snapshot | 19 | 20 | const modelsData = process.env.MODELS_DEV_API_JSON | @@ -26,7 +27,11 @@ await Bun.write( | 26 | 27 | console.log("Generated models-snapshot.ts") | 27 | 28 |
| 28 | 29 | // Load migrations from migration directories | 29 | | -const migrationDirs = (await fs.promises.readdir(path.join(dir, "migration"), { withFileTypes: true })) | | 30 | +const migrationDirs = ( | | 31 | + await fs.promises.readdir(path.join(dir, "migration"), { | | 32 | + withFileTypes: true, | | 33 | + }) | | 34 | +) | 30 | 35 | .filter((entry) => entry.isDirectory() && /^\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}/.test(entry.name)) | 31 | 36 | .map((entry) => entry.name) | 32 | 37 | .sort() | @@ -171,7 +176,6 @@ for (const item of targets) { | 171 | 176 | compile: { | 172 | 177 | autoloadBunfig: false, | 173 | 178 | autoloadDotenv: false, | 174 | | - //@ts-ignore (bun types aren't up to date) | 175 | 179 | autoloadTsconfig: true, | 176 | 180 | autoloadPackageJson: true, | 177 | 181 | target: name.replace(pkg.name, "bun") as any, | @@ -214,7 +218,7 @@ if (Script.release) { | 214 | 218 | await $`zip -r ../../${key}.zip *`.cwd(`dist/${key}/bin`) | 215 | 219 | } | 216 | 220 | } | 217 | | - await $`gh release upload v${Script.version} ./dist/*.zip ./dist/*.tar.gz --clobber` | | 221 | + await $`gh release upload v${Script.version} ./dist/*.zip ./dist/*.tar.gz --clobber --repo ${process.env.GH_REPO}` | 218 | 222 | } | 219 | 223 |
| 220 | 224 | export { binaries } |
Collapse file Copy file name to clipboardExpand all lines: script/publish.ts +10-7Lines changed: 10 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -57,13 +57,16 @@ await $`bun install` | 57 | 57 | await import(`../packages/sdk/js/script/build.ts`) | 58 | 58 |
| 59 | 59 | if (Script.release) { | 60 | | - await $`git commit -am "release: v${Script.version}"` | 61 | | - await $`git tag v${Script.version}` | 62 | | - await $`git fetch origin` | 63 | | - await $`git cherry-pick HEAD..origin/dev`.nothrow() | 64 | | - await $`git push origin HEAD --tags --no-verify --force-with-lease` | 65 | | - await new Promise((resolve) => setTimeout(resolve, 5_000)) | 66 | | - await $`gh release edit v${Script.version} --draft=false` | | 60 | + if (!Script.preview) { | | 61 | + await $`git commit -am "release: v${Script.version}"` | | 62 | + await $`git tag v${Script.version}` | | 63 | + await $`git fetch origin` | | 64 | + await $`git cherry-pick HEAD..origin/dev`.nothrow() | | 65 | + await $`git push origin HEAD --tags --no-verify --force-with-lease` | | 66 | + await new Promise((resolve) => setTimeout(resolve, 5_000)) | | 67 | + } | | 68 | + | | 69 | + await $`gh release edit v${Script.version} --draft=false --repo ${process.env.GH_REPO}` | 67 | 70 | } | 68 | 71 |
| 69 | 72 | console.log("\n=== cli ===\n") | |
Collapse file Copy file name to clipboardExpand all lines: script/version.ts +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,8 +17,16 @@ if (!Script.preview) { | 17 | 17 | const release = await $`gh release view v${Script.version} --json tagName,databaseId`.json() | 18 | 18 | output.push(`release=${release.databaseId}`) | 19 | 19 | output.push(`tag=${release.tagName}`) | | 20 | +} else if (Script.channel === "beta") { | | 21 | + await $`gh release create v${Script.version} -d --title "v${Script.version}" --repo ${process.env.GH_REPO}` | | 22 | + const release = | | 23 | + await $`gh release view v${Script.version} --json tagName,databaseId --repo ${process.env.GH_REPO}`.json() | | 24 | + output.push(`release=${release.databaseId}`) | | 25 | + output.push(`tag=${release.tagName}`) | 20 | 26 | } | 21 | 27 |
| | 28 | +output.push(`repo=${process.env.GH_REPO}`) | | 29 | + | 22 | 30 | if (process.env.GITHUB_OUTPUT) { | 23 | 31 | await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n")) | 24 | 32 | } | |
|