From 9d4ed5b04a437a50db8acde885740765978961e4 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 11 Dec 2025 16:49:12 -0500 Subject: console: fix download links to use dynamic GitHub release version --- packages/console/app/src/routes/download/index.tsx | 55 ++++++++++------------ 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'packages/console/app') diff --git a/packages/console/app/src/routes/download/index.tsx b/packages/console/app/src/routes/download/index.tsx index 311b641c6..eb1d38fa5 100644 --- a/packages/console/app/src/routes/download/index.tsx +++ b/packages/console/app/src/routes/download/index.tsx @@ -1,6 +1,6 @@ import "./index.css" import { Title, Meta, Link } from "@solidjs/meta" -import { A } from "@solidjs/router" +import { A, createAsync, query } from "@solidjs/router" import { Header } from "~/component/header" import { Footer } from "~/component/footer" import { IconCopy, IconCheck } from "~/component/icon" @@ -9,6 +9,13 @@ import desktopAppIcon from "../../asset/lander/opencode-desktop-icon.png" import { Legal } from "~/component/legal" import { config } from "~/config" +const getLatestRelease = query(async () => { + const response = await fetch("https://api.github.com/repos/sst/opencode/releases/latest") + if (!response.ok) return null + const data = await response.json() + return data.tag_name as string +}, "latest-release") + function CopyStatus() { return ( @@ -19,6 +26,12 @@ function CopyStatus() { } export default function Download() { + const release = createAsync(() => getLatestRelease()) + const download = () => { + const version = release() + if (!version) return null + return `https://github.com/sst/opencode/releases/download/${version}` + } const handleCopyClick = (command: string) => (event: Event) => { const button = event.currentTarget as HTMLButtonElement navigator.clipboard.writeText(command) @@ -43,17 +56,6 @@ export default function Download() {

Download OpenCode

Available in Beta for macOS, Windows, and Linux

-
@@ -117,7 +119,7 @@ export default function Download() { macOS (Apple Silicon)
- + Download @@ -133,7 +135,7 @@ export default function Download() { macOS (Intel) - + Download @@ -156,7 +158,7 @@ export default function Download() { Windows (x64) - + Download @@ -164,22 +166,15 @@ export default function Download() {
- - - - - - - - + - Windows (Arm) + Linux (.deb)
- + Download @@ -193,9 +188,9 @@ export default function Download() { /> - Linux + Linux (.rpm) - + Download -- cgit v1.2.3